Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,50 @@
</ProjectReference>
</ItemGroup>

<PropertyGroup>
<_AnalyzerVariantsDir>..\..\artifacts\analyzer-variants</_AnalyzerVariantsDir>
</PropertyGroup>

<ItemGroup>
<_RoslynVariant Include="4.8.0">
<Folder>roslyn4.8</Folder>
</_RoslynVariant>
<_RoslynVariant Include="5.0.0">
<Folder>roslyn5.0</Folder>
</_RoslynVariant>
</ItemGroup>

<Target Name="_BuildAnalyzerVariants" BeforeTargets="GenerateNuspec" Condition="'$(NoBuild)' != 'true'">
<MSBuild
Projects="..\EntityFrameworkCore.Projectables.Generator\EntityFrameworkCore.Projectables.Generator.csproj"
Targets="Restore;Build"
Properties="Configuration=$(Configuration);RoslynAnalyzerVersion=%(_RoslynVariant.Identity);BaseOutputPath=$(_AnalyzerVariantsDir)\Generator-%(_RoslynVariant.Folder)\bin\;BaseIntermediateOutputPath=$(_AnalyzerVariantsDir)\Generator-%(_RoslynVariant.Folder)\obj\"
RemoveProperties="TargetFramework" />
<MSBuild
Projects="..\EntityFrameworkCore.Projectables.CodeFixes\EntityFrameworkCore.Projectables.CodeFixes.csproj"
Targets="Restore;Build"
Properties="Configuration=$(Configuration);RoslynAnalyzerVersion=%(_RoslynVariant.Identity);BaseOutputPath=$(_AnalyzerVariantsDir)\CodeFixes-%(_RoslynVariant.Folder)\bin\;BaseIntermediateOutputPath=$(_AnalyzerVariantsDir)\CodeFixes-%(_RoslynVariant.Folder)\obj\"
RemoveProperties="TargetFramework" />
</Target>

<Target Name="_CheckAnalyzerVariants" BeforeTargets="GenerateNuspec" Condition="'$(NoBuild)' == 'true'">
<Error Condition="!Exists('$(_AnalyzerVariantsDir)\Generator-roslyn4.8\bin\$(Configuration)\netstandard2.0\EntityFrameworkCore.Projectables.Generator.dll') OR !Exists('$(_AnalyzerVariantsDir)\Generator-roslyn5.0\bin\$(Configuration)\netstandard2.0\EntityFrameworkCore.Projectables.Generator.dll')"
Text="Roslyn-variant analyzer DLLs are missing under '$(_AnalyzerVariantsDir)'. Run 'dotnet pack' without --no-build to produce them." />
</Target>

<Target Name="_CleanAnalyzerVariants" AfterTargets="Clean">
<RemoveDir Directories="$(_AnalyzerVariantsDir)\Generator-%(_RoslynVariant.Folder);$(_AnalyzerVariantsDir)\CodeFixes-%(_RoslynVariant.Folder)" />
</Target>

<ItemGroup>
<!-- Package the generator and the code fix provider in the analyzer directory of the nuget package -->
<None Include="..\EntityFrameworkCore.Projectables.Generator\bin\$(Configuration)\netstandard2.0\EntityFrameworkCore.Projectables.Generator.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="..\EntityFrameworkCore.Projectables.CodeFixes\bin\$(Configuration)\netstandard2.0\EntityFrameworkCore.Projectables.CodeFixes.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(_AnalyzerVariantsDir)\Generator-roslyn4.8\bin\$(Configuration)\netstandard2.0\EntityFrameworkCore.Projectables.Generator.dll"
Pack="true" PackagePath="analyzers/dotnet/roslyn4.8/cs" Visible="false" />
<None Include="$(_AnalyzerVariantsDir)\CodeFixes-roslyn4.8\bin\$(Configuration)\netstandard2.0\EntityFrameworkCore.Projectables.CodeFixes.dll"
Pack="true" PackagePath="analyzers/dotnet/roslyn4.8/cs" Visible="false" />
<None Include="$(_AnalyzerVariantsDir)\Generator-roslyn5.0\bin\$(Configuration)\netstandard2.0\EntityFrameworkCore.Projectables.Generator.dll"
Pack="true" PackagePath="analyzers/dotnet/roslyn5.0/cs" Visible="false" />
<None Include="$(_AnalyzerVariantsDir)\CodeFixes-roslyn5.0\bin\$(Configuration)\netstandard2.0\EntityFrameworkCore.Projectables.CodeFixes.dll"
Pack="true" PackagePath="analyzers/dotnet/roslyn5.0/cs" Visible="false" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<NoWarn>$(NoWarn);NU5128</NoWarn>
<IsPackable>false</IsPackable>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<!-- See Generator.csproj for rationale. Excludes the canonical bin/obj from the
auto-Compile glob so the Roslyn-variant build doesn't pick up AssemblyInfo
duplicates from the cascaded ProjectReference build. -->
<DefaultItemExcludes>$(DefaultItemExcludes);bin\**;obj\**</DefaultItemExcludes>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@
<NoWarn>$(NoWarn);NU5128</NoWarn>
<IsPackable>false</IsPackable>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<!-- Exclude bin/ and obj/ from auto-Compile glob unconditionally. For canonical builds
this duplicates the SDK's existing exclusion (no-op). For Roslyn-variant builds
(BaseOutputPath/BaseIntermediateOutputPath relocated outside the project), it
prevents the canonical obj/ — populated by the cascaded ProjectReference build
in the same pack invocation — from being picked up and CS0579-conflicting with
the variant's own generated AssemblyInfo.cs. -->
<DefaultItemExcludes>$(DefaultItemExcludes);bin\**;obj\**</DefaultItemExcludes>
</PropertyGroup>

<!-- Define ROSLYN_5_0_OR_LATER when building with .NET SDK 10+ (NETCoreSdkVersion is set by
Microsoft.NET.Sdk.props, which runs before this project file body is evaluated).
This enables C# 14 extension-type support in the generator code.
On SDK 9 the constant is absent and extension block members are skipped safely. -->
<PropertyGroup Condition="'$(NETCoreSdkVersion)' != '' AND $([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '10.0.0'))">
<!-- Define ROSLYN_5_0_OR_LATER when compiling against Roslyn 5.0+ reference assemblies.
Keyed off $(RoslynAnalyzerVersion) (auto-detected in Directory.Build.props, or
overridden by the dual-build target in EntityFrameworkCore.Projectables.Abstractions.csproj)
so a recursive build with RoslynAnalyzerVersion=4.8.0 produces a Roslyn-4.8-compatible
DLL even on a host running .NET SDK 10. -->
<PropertyGroup Condition="'$(RoslynAnalyzerVersion)' != '' AND $([MSBuild]::VersionGreaterThanOrEquals('$(RoslynAnalyzerVersion)', '5.0.0'))">
<DefineConstants>$(DefineConstants);ROSLYN_5_0_OR_LATER</DefineConstants>
</PropertyGroup>

Expand Down
Loading