mirror of
https://github.com/CommunityToolkit/dotnet.git
synced 2026-10-28 19:17:46 +08:00
66 lines
3.6 KiB
XML
66 lines
3.6 KiB
XML
<Project Sdk="Microsoft.NET.Sdk">
|
|
|
|
<PropertyGroup>
|
|
<TargetFramework>netstandard2.0</TargetFramework>
|
|
<IsPackable>false</IsPackable>
|
|
</PropertyGroup>
|
|
|
|
<!--
|
|
The MVVM Toolkit source generators rely on Roslyn multi-targeting to support multiple versions of the Microsoft.CodeAnalysis.CSharp package.
|
|
This package reference actually needs a matching version of Roslyn to be available for consumers of the source generator, so if we always
|
|
used the latest version, the MVVM Toolkit would just fail to load for users of eg. an older version of Visual Studio. Thankfully, Roslyn
|
|
supports analyzers that bundle multiple versions in the same NuGet package, each in a subfolder with a name matching the Roslyn version.
|
|
To leverage this, this project receives the MvvmToolkitSourceGeneratorRoslynVersion property as input, so that the MVVM Toolkit can build
|
|
it multiple times with multiple versions during packing, to then extract each .dll and copy it to the right NuGet package folder.
|
|
-->
|
|
<PropertyGroup>
|
|
|
|
<!-- When the property is not set (which will not happen when creating a NuGet package anyway), just default to 4.0.1 -->
|
|
<MvvmToolkitSourceGeneratorRoslynVersion Condition="'$(MvvmToolkitSourceGeneratorRoslynVersion)' == ''">4.0.1</MvvmToolkitSourceGeneratorRoslynVersion>
|
|
|
|
<!--
|
|
The output path will end up being eg. "bin\Debug\roslyn4.0\netstandard2.0" (the trailing "netstandard2.0" is added automatically).
|
|
This is only set when $(MvvmToolkitIsGeneratingNuGetPackage) is set (when packing CommunityToolkit.Mvvm). This avoids unit test issues.
|
|
-->
|
|
<OutputPath Condition="'$(MvvmToolkitIsGeneratingNuGetPackage)' == 'true'">bin\$(Configuration)\roslyn$(MvvmToolkitSourceGeneratorRoslynVersion.Substring(0, 3))\</OutputPath>
|
|
|
|
<!-- Also define a "ROSLYN_<MAJOR>_<MINOR>" build constant, so the generator code can multi-target whenever needed and add any required polyfills -->
|
|
<DefineConstants>$(DefineConstants);ROSLYN_$(MvvmToolkitSourceGeneratorRoslynVersion.Substring(0, 3).Replace('.', '_'))</DefineConstants>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<Compile Remove="EmbeddedResources\INotifyPropertyChanged.cs" />
|
|
<Compile Remove="EmbeddedResources\NotNullAttribute.cs" />
|
|
<Compile Remove="EmbeddedResources\NotNullIfNotNullAttribute.cs" />
|
|
<Compile Remove="EmbeddedResources\ObservableObject.cs" />
|
|
<Compile Remove="EmbeddedResources\ObservableRecipient.cs" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup>
|
|
<EmbeddedResource Include="EmbeddedResources\INotifyPropertyChanged.cs">
|
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
</EmbeddedResource>
|
|
<EmbeddedResource Include="EmbeddedResources\NotNullAttribute.cs">
|
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
</EmbeddedResource>
|
|
<EmbeddedResource Include="EmbeddedResources\NotNullIfNotNullAttribute.cs">
|
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
</EmbeddedResource>
|
|
<EmbeddedResource Include="EmbeddedResources\ObservableObject.cs">
|
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
</EmbeddedResource>
|
|
<EmbeddedResource Include="EmbeddedResources\ObservableRecipient.cs">
|
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
</EmbeddedResource>
|
|
</ItemGroup>
|
|
|
|
<ItemGroup>
|
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MvvmToolkitSourceGeneratorRoslynVersion)" PrivateAssets="all" Pack="false" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup>
|
|
<AdditionalFiles Include="AnalyzerReleases.Shipped.md" />
|
|
<AdditionalFiles Include="AnalyzerReleases.Unshipped.md" />
|
|
</ItemGroup>
|
|
|
|
</Project> |