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 all 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
21 changes: 17 additions & 4 deletions src/Sentry/Sentry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,23 @@
<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" />
<SentryAnalyzerProjectReference Include="..\Sentry.SourceGenerators\Sentry.SourceGenerators.csproj" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

We've got this in various other places throughout the solution. I'm wondering if it should be in one or more of the Directory.Build.props files (e.g. the one in the Samples directory, at the very least).

<ProjectReference Include="..\..\src\Sentry.SourceGenerators\Sentry.SourceGenerators.csproj"/>

<ProjectReference Include="..\..\src\Sentry.SourceGenerators\Sentry.SourceGenerators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"/>

<ProjectReference Include="..\..\src\Sentry.SourceGenerators\Sentry.SourceGenerators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"/>

<ProjectReference Include="..\..\src\Sentry.SourceGenerators\Sentry.SourceGenerators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"/>

</ItemGroup>
<Target Name="_SentryPackAnalyzers" BeforeTargets="GenerateNuspec;_GetPackageFiles">
<Message Text="Target: '_SentryPackAnalyzers' with Analyzer-Projects: '@(SentryAnalyzerProjectReference)'" Importance="high" />
<MSBuild Projects="@(SentryAnalyzerProjectReference)" Properties="Configuration=$(Configuration);TargetFramework=netstandard2.0"/>
<MSBuild Projects="@(SentryAnalyzerProjectReference)" Properties="Configuration=$(Configuration);TargetFramework=netstandard2.0" 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