|
20 | 20 | <PackageTags>MVVM;Toolkit;MVVMToolkit;INotifyPropertyChanged;Observable;IOC;DI;Dependency Injection;Object Messaging;Extensions;Helpers</PackageTags> |
21 | 21 | </PropertyGroup> |
22 | 22 |
|
23 | | - <!-- Enable trimming support on .NET 6 --> |
| 23 | + <!-- Enable assembly trimming on .NET 6+ --> |
24 | 24 | <PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'"> |
25 | 25 | <EnableTrimAnalyzer>true</EnableTrimAnalyzer> |
26 | 26 | <IsTrimmable>true</IsTrimmable> |
27 | 27 | </PropertyGroup> |
28 | 28 |
|
29 | 29 | <!-- |
30 | | - Include the custom .targets file to check the source generator. |
31 | | - .NET 6 is not needed as it guarantees Roslyn 4.x. |
| 30 | + Include a custom targets file to check the compiler version required for the source generator. |
| 31 | + It needs Roslyn 4.x and including the targets in .NET 6+ is not needed as it guarantees the same. |
32 | 32 | --> |
33 | 33 | <ItemGroup> |
34 | 34 | <None Include="CommunityToolkit.Mvvm.targets" Pack="True" PackagePath="build\netstandard2.0" /> |
|
62 | 62 | </ItemGroup> |
63 | 63 |
|
64 | 64 | <!-- |
65 | | - Pack the source generator to the right package folders (each matching the target Roslyn version). |
66 | | - Roslyn will automatically load the highest version compatible with Roslyn's version in the SDK. |
| 65 | + Pack the source generator build outputs to the correct package folders (for each target Roslyn version) |
| 66 | + for them to be used as analyzers. Roslyn compilers will automatically load the highest version compatible |
| 67 | + with the Roslyn's version in the SDK. |
| 68 | +
|
| 69 | + HACK: The recommended way to pack is to get the build outputs using the project's built-in targets, |
| 70 | + and include them using NuGet's Pack targets. However, due to a bug in v5 of those targets, |
| 71 | + the outputs were not included in the package. So, including them directly via final |
| 72 | + output path and building it first is the only way to ensure they are included. |
67 | 73 | --> |
68 | 74 | <ItemGroup> |
69 | 75 | <None Include="..\CommunityToolkit.Mvvm.SourceGenerators\bin\$(Configuration)\roslyn4.0\netstandard2.0\CommunityToolkit.Mvvm.SourceGenerators.dll" PackagePath="analyzers\dotnet\roslyn4.0\cs" Pack="true" Visible="false" /> |
|
0 commit comments