Skip to content
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

Fix build error when building some packages #56767

Merged
merged 2 commits into from
Aug 3, 2021
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
16 changes: 0 additions & 16 deletions eng/packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,8 @@
<PackageDesignerMarkerFile>$(MSBuildThisFileDirectory)useSharedDesignerContext.txt</PackageDesignerMarkerFile>
<PackageValidationBaselineVersion Condition="'$(PackageValidationBaselineVersion)' == ''">$([MSBuild]::Subtract($(MajorVersion), 1)).0.0</PackageValidationBaselineVersion>
<BeforePack>IncludeAnalyzersInPackage;$(BeforePack)</BeforePack>
<BuildAnalyzerReferences>$(BuildProjectReferences)</BuildAnalyzerReferences>
<BuildAnalyzerReferences Condition="'$(BuildingInsideVisualStudio)' == 'true'">false</BuildAnalyzerReferences>
</PropertyGroup>

<ItemGroup>
<!-- Ensure AnalyzerReference items are restored and built
The target framework of Analyzers has no relationship to that of the refrencing project,
so we don't apply TargetFramework filters nor do we pass in TargetFramework.
When BuildProjectReferences=false we make sure to set BuildReference=false to make
sure not to try to call GetTargetPath in the outerbuild of the analyzer project. -->
<ProjectReference Include="@(AnalyzerReference)"
SkipGetTargetFrameworkProperties="true"
UndefineProperties="TargetFramework"
ReferenceOutputAssembly="false"
PrivateAssets="all"
BuildReference="$(BuildAnalyzerReferences)" />
</ItemGroup>

<!-- There are some packages where we require only one ref for a specific framework to be present. In order to avoid problems with this package when targetting
dektop with RAR we will make sure there are no exclude=compile references in the package.
For more info, please check issues:
Expand Down
19 changes: 19 additions & 0 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,24 @@
</When>
</Choose>

<PropertyGroup>
<BuildAnalyzerReferences>$(BuildProjectReferences)</BuildAnalyzerReferences>
<BuildAnalyzerReferences Condition="'$(BuildingInsideVisualStudio)' == 'true'">false</BuildAnalyzerReferences>
</PropertyGroup>

<ItemGroup>
<!-- Ensure AnalyzerReference items are restored and built
The target framework of Analyzers has no relationship to that of the refrencing project,
so we don't apply TargetFramework filters nor do we pass in TargetFramework.
When BuildProjectReferences=false we make sure to set BuildReference=false to make
sure not to try to call GetTargetPath in the outerbuild of the analyzer project. -->
<ProjectReference Include="@(AnalyzerReference)"
SkipGetTargetFrameworkProperties="true"
UndefineProperties="TargetFramework"
ReferenceOutputAssembly="false"
PrivateAssets="all"
BuildReference="$(BuildAnalyzerReferences)" />
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)workloads-testing.targets" />
</Project>