File tree Expand file tree Collapse file tree
Magicodes.IE.IO.SourceGenerator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,17 +64,20 @@ jobs:
6464 inputs :
6565 targetType : ' inline'
6666 script : |
67- # 打包
68- Get-ChildItem -Path ./ -Recurse |
67+ # 清理 bin/obj 残留(避免 BenchmarkDotNet/IISExpress 等自动生成的 csproj 被误打包)
68+ Get-ChildItem -Path ./bin, ./obj -Recurse -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
69+
70+ # 打包(仅 src/ 下的非 Test 项目)
71+ Get-ChildItem -Path ./src -Recurse |
6972 Where-Object { $_.Name.EndsWith(".csproj") -and !$_.Name.Contains("Test") } |
7073 ForEach-Object -Process {
7174 Write-Host $_.Name
72- dotnet pack $_.FullName -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg --include-source - -output $(Build.ArtifactStagingDirectory) -c $(BuildConfiguration)
75+ dotnet pack $_.FullName --output $(Build.ArtifactStagingDirectory) -c $(BuildConfiguration)
7376 }
7477 ls $(Build.ArtifactStagingDirectory)
7578
76- #推包
77- dotnet nuget push $(Build.ArtifactStagingDirectory)\*.nupkg -k $env:NUGET_API_KEY --skip-duplicate -s https://api.nuget.org/v3/index.json
79+ #推包(nupkg + snupkg 原子推送)
80+ dotnet nuget push $(Build.ArtifactStagingDirectory)\*.nupkg -k $env:NUGET_API_KEY --skip-duplicate -s https://api.nuget.org/v3/index.json
7881 failOnStderr : true
7982 showWarnings : true
8083 ignoreLASTEXITCODE : true
Original file line number Diff line number Diff line change 1010 <DevelopmentDependency >true</DevelopmentDependency >
1111 <SuppressDependenciesWhenPacking >true</SuppressDependenciesWhenPacking >
1212 <ManagePackageVersionsCentrally >false</ManagePackageVersionsCentrally >
13+ <IsPackable >false</IsPackable >
1314 <PackageId >Magicodes.IE.IO.SourceGenerator</PackageId >
1415 <Description >Source generator for Magicodes.IE.IO — generates typed property getters at compile time, eliminating Expression.Compile runtime reflection.</Description >
1516 </PropertyGroup >
Original file line number Diff line number Diff line change 2525 ReferenceOutputAssembly =" false" />
2626 </ItemGroup >
2727
28- <Target Name =" PackSourceGenerator"
29- BeforeTargets =" _GetPackageFiles"
30- DependsOnTargets =" Build" >
28+ <!--
29+ Pack the source generator as a NuGet analyzer.
30+ SG is already a ProjectReference — dotnet pack builds it during the Build phase,
31+ so we do NOT add DependsOnTargets="Build" here (it would double-build and leak
32+ the SG's PDB into the .snupkg, failing NuGet symbol validation).
33+ -->
34+ <Target Name =" PackSourceGenerator" BeforeTargets =" _GetPackageFiles" >
3135 <ItemGroup >
32- <None Include =" ../Magicodes.IE.IO.SourceGenerator/bin/$(Configuration)/netstandard2.0/Magicodes.IE.IO.SourceGenerator.dll"
36+ <None Include =" $(MSBuildThisFileDirectory) ../Magicodes.IE.IO.SourceGenerator/bin/$(Configuration)/netstandard2.0/Magicodes.IE.IO.SourceGenerator.dll"
3337 Pack =" true"
3438 PackagePath =" analyzers/dotnet/cs/"
3539 Visible =" false" />
You can’t perform that action at this time.
0 commit comments