|
11 | 11 | <Description>.NET ATProtocol Library, built for bindings with source generators.</Description> |
12 | 12 | <DevelopmentDependency>false</DevelopmentDependency> |
13 | 13 | <SuppressDependenciesWhenPacking>false</SuppressDependenciesWhenPacking> |
| 14 | + <NoPackageAnalysis>true</NoPackageAnalysis> |
| 15 | + <!-- Hook into the pack pipeline to add analyzer, targets, and task files --> |
| 16 | + <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddSourceGenPackageFiles</TargetsForTfmSpecificContentInPackage> |
14 | 17 | </PropertyGroup> |
15 | 18 |
|
16 | 19 | <ItemGroup> |
|
29 | 32 | <ProjectReference Include="..\CarpaNet.SourceGen\CarpaNet.SourceGen.csproj" |
30 | 33 | ReferenceOutputAssembly="false" |
31 | 34 | SkipGetTargetFrameworkProperties="true" |
32 | | - SetTargetFramework="TargetFramework=netstandard2.0" /> |
33 | | - <ProjectReference Include="..\CarpaNet.BuildTasks\CarpaNet.BuildTasks.csproj" |
34 | | - ReferenceOutputAssembly="false" |
35 | | - SkipGetTargetFrameworkProperties="true" |
36 | | - SetTargetFramework="TargetFramework=net8.0" /> |
37 | | - </ItemGroup> |
38 | | - |
39 | | - <!-- Pack the source generator analyzer DLLs --> |
40 | | - <ItemGroup> |
41 | | - <None Include="..\CarpaNet.SourceGen\$(OutputPath)\CarpaNet.SourceGen.dll" |
42 | | - Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> |
43 | | - <None Include="$(PkgSystem_Text_Json)\lib\netstandard2.0\System.Text.Json.dll" |
44 | | - Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> |
| 35 | + GlobalPropertiesToRemove="TargetFramework" /> |
45 | 36 | </ItemGroup> |
46 | 37 |
|
47 | | - <!-- Pack build targets --> |
48 | | - <ItemGroup> |
49 | | - <None Include="build\CarpaNet.targets" Pack="true" PackagePath="build\" Visible="false" /> |
50 | | - <None Include="build\CarpaNet.targets" Pack="true" PackagePath="buildTransitive\" Visible="false" /> |
51 | | - </ItemGroup> |
52 | | - |
53 | | - <!-- Pack the build task DLL --> |
54 | | - <ItemGroup> |
55 | | - <None Include="..\CarpaNet.BuildTasks\bin\$(Configuration)\net8.0\CarpaNet.BuildTasks.dll" |
56 | | - Pack="true" PackagePath="tasks\net8.0\" Visible="false" /> |
57 | | - </ItemGroup> |
| 38 | + <!-- Add source generator, build targets, and build tasks to the NuGet package. |
| 39 | + Uses TargetsForTfmSpecificContentInPackage so properties like PkgSystem_Text_Json |
| 40 | + are resolved at pack time. Only added for one TFM to avoid duplicates. --> |
| 41 | + <Target Name="_AddSourceGenPackageFiles" Condition="'$(TargetFramework)' == 'netstandard2.0'"> |
| 42 | + <ItemGroup> |
| 43 | + <!-- Analyzer DLLs --> |
| 44 | + <TfmSpecificPackageFile Include="..\CarpaNet.SourceGen\bin\$(Configuration)\netstandard2.0\CarpaNet.SourceGen.dll" |
| 45 | + PackagePath="analyzers/dotnet/cs" /> |
| 46 | + <TfmSpecificPackageFile Include="$(PkgSystem_Text_Json)\lib\netstandard2.0\System.Text.Json.dll" |
| 47 | + PackagePath="analyzers/dotnet/cs" /> |
| 48 | + <!-- Build targets --> |
| 49 | + <TfmSpecificPackageFile Include="build\CarpaNet.targets" |
| 50 | + PackagePath="build" /> |
| 51 | + <TfmSpecificPackageFile Include="build\CarpaNet.targets" |
| 52 | + PackagePath="buildTransitive" /> |
| 53 | + <!-- Build task DLL --> |
| 54 | + <TfmSpecificPackageFile Include="..\CarpaNet.BuildTasks\bin\$(Configuration)\net8.0\CarpaNet.BuildTasks.dll" |
| 55 | + PackagePath="tasks/net8.0" /> |
| 56 | + </ItemGroup> |
| 57 | + </Target> |
58 | 58 |
|
59 | 59 | <Import Project="..\..\Version.props" /> |
60 | 60 | </Project> |
0 commit comments