Skip to content
Merged
Next Next commit
Add 'CommunityToolkit.Mvvm.Windows.targets'
  • Loading branch information
Sergio0694 committed Nov 7, 2024
commit 1599d68b9b1fc42bed88931c47aa0f29acd352a4
17 changes: 17 additions & 0 deletions src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.Windows.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project>

<!-- Allows the generators and analyzers to determine whether the current project is targeting Windows on modern .NET -->
<PropertyGroup>
<_MvvmToolkitIsUsingWindowsRuntimePack>false</_MvvmToolkitIsUsingWindowsRuntimePack>
<_MvvmToolkitIsUsingWindowsRuntimePack Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0-windows10.0.17763.0'))">true</_MvvmToolkitIsUsingWindowsRuntimePack>
</PropertyGroup>

<!-- MSBuild properties that generators and analyzers need access to -->
<ItemGroup>
<CompilerVisibleProperty Include="_MvvmToolkitIsUsingWindowsRuntimePack" />
<CompilerVisibleProperty Include="CsWinRTComponent" />
<CompilerVisibleProperty Include="CsWinRTAotOptimizerEnabled" />
<CompilerVisibleProperty Include="CsWinRTAotWarningLevel" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@
<!-- Include the custom .targets files (shared across TFMs) -->
<None Include="CommunityToolkit.Mvvm.FeatureSwitches.targets" PackagePath="build" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="build" Pack="true" />
<None Include="CommunityToolkit.Mvvm.Windows.targets" PackagePath="build" Pack="true" />
<None Include="CommunityToolkit.Mvvm.WindowsSdk.targets" PackagePath="build" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="build" Pack="true" />
<None Include="CommunityToolkit.Mvvm.FeatureSwitches.targets" PackagePath="buildTransitive" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="buildTransitive" Pack="true" />
<None Include="CommunityToolkit.Mvvm.Windows.targets" PackagePath="buildTransitive" Pack="true" />
<None Include="CommunityToolkit.Mvvm.WindowsSdk.targets" PackagePath="buildTransitive" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="buildTransitive" Pack="true" />

Expand Down
2 changes: 2 additions & 0 deletions src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
<PropertyGroup>
<_CommunityToolkitMvvmFeatureSwitchesTargets>$(MSBuildThisFileDirectory)CommunityToolkit.Mvvm.FeatureSwitches.targets</_CommunityToolkitMvvmFeatureSwitchesTargets>
<_CommunityToolkitMvvmSourceGeneratorsTargets>$(MSBuildThisFileDirectory)CommunityToolkit.Mvvm.SourceGenerators.targets</_CommunityToolkitMvvmSourceGeneratorsTargets>
<_CommunityToolkitMvvmWindowsTargets>$(MSBuildThisFileDirectory)CommunityToolkit.Mvvm.Windows.targets</_CommunityToolkitMvvmWindowsTargets>
<_CommunityToolkitMvvmWindowsSdkTargets>$(MSBuildThisFileDirectory)CommunityToolkit.Mvvm.WindowsSdk.targets</_CommunityToolkitMvvmWindowsSdkTargets>
</PropertyGroup>

<!-- Import all available .targets -->
<Import Project="$(_CommunityToolkitMvvmFeatureSwitchesTargets)" />
<Import Project="$(_CommunityToolkitMvvmSourceGeneratorsTargets)" />
<Import Project="$(_CommunityToolkitMvvmWindowsTargets)" />
<Import Project="$(_CommunityToolkitMvvmWindowsSdkTargets)" />

</Project>