Skip to content

build: Fix reference to Sentry.SourceGenerators #4307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/Sentry/Sentry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,22 @@
<None Include="buildTransitive\Sentry.SourceGenerators.targets" Pack="true" PackagePath="build\Sentry.SourceGenerators.targets" />
</ItemGroup>

<!-- Build and Pack (without dependency to) Roslyn Components / Compiler Extensions (as "analyzers"). -->
<!-- See https://learn.microsoft.com/dotnet/core/project-sdk/overview -->
<!-- See also https://github.com/ViktorHofer/PackAsAnalyzer -->
<ItemGroup>
<None Include="..\Sentry.SourceGenerators\bin\Release\netstandard2.0\Sentry.SourceGenerators.dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false" />
<ProjectReference Include="..\Sentry.SourceGenerators\Sentry.SourceGenerators.csproj" OutputItemType="" ReferenceOutputAssembly="false" PrivateAssets="all" SetTargetFramework="TargetFramework=netstandard2.0" SentryAnalyzersPack="true" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: parallel builds

Workflows sometimes run into:

/Users/runner/.dotnet/sdk/9.0.301/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(323,5): error MSB4018: System.IO.IOException: The process cannot access the file '/Users/runner/work/sentry-dotnet/sentry-dotnet/src/Sentry.SourceGenerators/bin/Release/netstandard2.0/Sentry.SourceGenerators.deps.json' because it is being used by another process. [/Users/runner/work/sentry-dotnet/sentry-dotnet/src/Sentry.SourceGenerators/Sentry.SourceGenerators.csproj]

</ItemGroup>
<Target Name="_SentryPackAnalyzers" BeforeTargets="_GetPackageFiles">
<Message Text="Target: '_SentryPackAnalyzers' with Analyzer-Projects: '@(ProjectReference->WithMetadataValue('SentryAnalyzersPack', 'true'))'" Importance="high" />
<MSBuild Projects="@(ProjectReference->WithMetadataValue('SentryAnalyzersPack', 'true'))" Targets="GetTargetPath">
<Output TaskParameter="TargetOutputs" ItemName="_SentryAnalyzersPackagePath" />
</MSBuild>
<Error Text="No analyzer assemblies found to pack." Condition="'@(_SentryAnalyzersPackagePath)' == ''" />
<Message Text="Packing Analyzers: '@(_SentryAnalyzersPackagePath)'" Importance="high" />
<ItemGroup>
<None Include="@(_SentryAnalyzersPackagePath)" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
</ItemGroup>
</Target>

</Project>
Loading