Skip to content

Commit 8d4a929

Browse files
committed
Clean up packaging
1 parent f50d744 commit 8d4a929

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
- name: Restore, Build, and Pack
2222
run: |
2323
dotnet restore *.sln
24-
dotnet build *.sln --configuration Release --no-restore
25-
dotnet pack *.sln --configuration Release --no-build --output ./artifacts
24+
dotnet build *.sln --configuration Release --no-restore -p:ContinuousIntegrationBuild=true
25+
dotnet pack *.sln --configuration Release --no-build --output ./artifacts -p:ContinuousIntegrationBuild=true
2626
2727
- name: Publish to NuGet
2828
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

SourceGeneratorContext/SourceGeneratorContext.csproj

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
<IsRoslynAnalyzer>true</IsRoslynAnalyzer>
2121
<DevelopmentDependency>true</DevelopmentDependency>
22+
<DebugType>portable</DebugType>
2223
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2324
</PropertyGroup>
2425

@@ -30,6 +31,7 @@
3031
<PackageReadmeFile>README.md</PackageReadmeFile>
3132
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
3233
<PackageLicenseExpression>MIT</PackageLicenseExpression>
34+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
3335
</PropertyGroup>
3436

3537
<PropertyGroup>
@@ -52,32 +54,29 @@
5254
<ItemGroup>
5355
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" PrivateAssets="all" />
5456
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0" PrivateAssets="all" />
57+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
58+
<PrivateAssets>all</PrivateAssets>
59+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
60+
</PackageReference>
5561
</ItemGroup>
5662

5763
<ItemGroup>
58-
<!-- This ensures the generator DLL itself is placed in the analyzers folder -->
59-
<!-- The SDK usually handles this automatically when Microsoft.CodeAnalysis.* are referenced -->
60-
<!-- but explicitly adding it can sometimes help if packing behaves unexpectedly. -->
61-
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
62-
6364
<!-- Pack the attributes dll in the analyzers/dotnet/cs path -->
64-
<None Include="$(OutputPath)\Datacute.SourceGeneratorContext.Attribute.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
65+
<None Include="..\SourceGeneratorContext.Attribute\bin\$(Configuration)\netstandard2.0\Datacute.SourceGeneratorContext.Attribute.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
66+
<!-- Explicitly pack the main DLL as an analyzer -->
67+
<None Include="$(TargetDir)$(TargetFileName)" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
68+
</ItemGroup>
6569

66-
<!-- Pack the attributes dll in the lib\netstandard2.0 path -->
67-
<None Include="$(OutputPath)\Datacute.SourceGeneratorContext.Attribute.dll" Pack="true" PackagePath="lib/netstandard2.0" Visible="false" />
68-
<None Include="$(OutputPath)\Datacute.SourceGeneratorContext.Attribute.xml" Pack="true" PackagePath="lib/netstandard2.0" Visible="false" />
70+
<ItemGroup>
71+
<!-- Pack the attributes dll and related files in the lib/netstandard2.0 path -->
72+
<None Include="..\SourceGeneratorContext.Attribute\bin\$(Configuration)\netstandard2.0\Datacute.SourceGeneratorContext.Attribute.dll" Pack="true" PackagePath="lib/netstandard2.0" Visible="false" />
73+
<None Include="..\SourceGeneratorContext.Attribute\bin\$(Configuration)\netstandard2.0\Datacute.SourceGeneratorContext.Attribute.xml" Pack="true" PackagePath="lib/netstandard2.0" Visible="false" />
74+
<None Include="..\SourceGeneratorContext.Attribute\bin\$(Configuration)\netstandard2.0\Datacute.SourceGeneratorContext.Attribute.pdb" Pack="true" PackagePath="lib/netstandard2.0" Visible="false" />
6975

7076
<None Include="../README.md" Pack="true" PackagePath="" />
7177
</ItemGroup>
7278

7379
<ItemGroup>
74-
<ProjectReference Include="..\SourceGeneratorContext.Attribute\SourceGeneratorContext.Attribute.csproj" />
80+
<ProjectReference Include="..\SourceGeneratorContext.Attribute\SourceGeneratorContext.Attribute.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="all" IncludeAssets="none" />
7581
</ItemGroup>
76-
77-
<Target Name="CopyDatacuteLightweightTracing" AfterTargets="Build">
78-
<ItemGroup>
79-
<DatacuteLightweightTracingFiles Include="$(PkgDatacute_LightweightTracing)\lib\netstandard2.0\*.dll" />
80-
</ItemGroup>
81-
<Copy SourceFiles="@(DatacuteLightweightTracingFiles)" DestinationFolder="$(OutputPath)" />
82-
</Target>
8382
</Project>

0 commit comments

Comments
 (0)