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

Suppress assembly architecture, assembly conflict and restore warnings #3323

Merged
merged 4 commits into from
Feb 4, 2022
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 @@ -2,6 +2,9 @@
<PropertyGroup>
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<!-- MSB3270 Suppress warnings about testhost being x64 (AMD64)/x86 when imported into AnyCPU (MSIL) projects. -->
<!-- MSB3276 Suppress warnings about conflicts between different versions of the same dependent assembly -->
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);MSB3270;MSB3276</MSBuildWarningsAsMessages>
nohwnd marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />
Expand Down
2 changes: 2 additions & 0 deletions scripts/build/TestPlatform.Settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
<When Condition="$(TestProject) == 'true'">
<PropertyGroup>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<!-- Suppress warnings about testhost being x64 (AMD64)/x86 when imported into AnyCPU (MSIL) test projects. -->
<NoWarn>$(NoWarn);MSB3270</NoWarn>
Copy link
Member

Choose a reason for hiding this comment

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

Do we need both this and the MSBuildWarningsAsMessages in each project?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't suppress this warning in each project, just in some. This is blanket suppression for all TestProjects.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I wasn't clear. I meant do we need both NoWarn and MSBuildWarningsAsMessages applied (I see that both are "suppressing" the MSB3270).

Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
<NoWarn>$(NoWarn);MSB3270</NoWarn>
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);MSB3270</MSBuildWarningsAsMessages>

Do I get it correctly that you want me to do this ^^^ ?

Copy link
Member

Choose a reason for hiding this comment

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

Or the other way around depending on which of the 2 property has wider area but yes :)

</PropertyGroup>

<!-- Test projects are not discovered in test window without test container capability -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- NU1702 suppresses warning about DumpMinitool being .NET Framework reference imported to a .NET project.
Unfortunately this can't be suppressed at single ProjectReference. Neither completely suppressed by using NoWarn.
Workaround is documented here: https://github.com/NuGet/Home/issues/8093, but this syntax and placement would be preferred:
https://github.com/dotnet/core/issues/869
-->
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);NU1702</MSBuildWarningsAsMessages>
<!-- MSB3270 Suppress warnings about testhost being x64 (AMD64)/x86 when imported into AnyCPU (MSIL) projects. -->
<!-- MSB3276 Suppress warnings about conflicts between different versions of the same dependent assembly -->
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);MSB3270;MSB3276</MSBuildWarningsAsMessages>
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
</PropertyGroup>
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<TargetFrameworks Condition=" '$(DotNetBuildFromSource)' == 'true' ">net6.0</TargetFrameworks>
<IsTestProject>false</IsTestProject>
<!-- This causes a build error on netcoreapp1.0 -->
<NoWarn Condition="'$(TargetFramework)' != 'netcoreapp1.0'">NU1605</NoWarn>
<NoWarn Condition="'$(TargetFramework)' != 'netcoreapp1.0'">$(NoWarn);NU1605</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0'">
Expand Down
3 changes: 3 additions & 0 deletions src/testhost.x86/testhost.x86.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<PropertyGroup>
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<!-- MSB3270 Suppress warnings about testhost being x64 (AMD64)/x86 when imported into AnyCPU (MSIL) projects. -->
<!-- MSB3276 Suppress warnings about conflicts between different versions of the same dependent assembly -->
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);MSB3270;MSB3276</MSBuildWarningsAsMessages>
</PropertyGroup>
<Import Project="$(TestPlatformRoot)src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems" Label="Shared" />
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />
Expand Down
3 changes: 3 additions & 0 deletions src/testhost/testhost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<PropertyGroup>
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<!-- MSB3270 Suppress warnings about testhost being x64 (AMD64)/x86 when imported into AnyCPU (MSIL) projects. -->
<!-- MSB3276 Suppress warnings about conflicts between different versions of the same dependent assembly -->
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);MSB3270;MSB3276</MSBuildWarningsAsMessages>
</PropertyGroup>
<Import Project="$(TestPlatformRoot)src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems" Label="Shared" />
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
<TestProject>true</TestProject>
<IsTestProject>true</IsTestProject>
<!-- NU1702 suppresses warning about testhost being .NET Framework reference imported to a .NET project.
Unfortunately this can't be suppressed at single ProjectReference. Neither completely suppressed by using NoWarn.
Workaround is documented here: https://github.com/NuGet/Home/issues/8093, but this syntax and placement would be preferred:
https://github.com/dotnet/core/issues/869
-->
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);NU1702</MSBuildWarningsAsMessages>
<!-- MSB3270 Suppress warnings about testhost being x64 (AMD64)/x86 when imported into AnyCPU (MSIL) projects. -->
<!-- MSB3276 Suppress warnings about conflicts between different versions of the same dependent assembly -->
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);MSB3270;MSB3276</MSBuildWarningsAsMessages>
</PropertyGroup>
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />
<PropertyGroup Label="Configuration">
Expand Down