dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.22k stars 1.35k forks source link

Add Ability to suppress MSB3270 at the individual assembly for a specific mismatch. #9695

Open vsfeedback opened 8 months ago

vsfeedback commented 8 months ago

This issue has been moved from a ticket on Developer Community.


Currently it is possible to completely suppress the warning

 <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
        None
    </ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>

This is problematic when C++/CLI is referencing Managed (AnyCPU), using platform specific dll's for the managed assemblies is NOT a solution.

Since this is a non-problem at runtime it would be beneficial to specify

--- Suppress Warning for My.Special.Selection.cll" when it is "AnyCPU"

This would allow other mismatches which may be important to generate warnings but the specific occurances of specific types would be suppressed.


Original Comments

Feedback Bot on 6/27/2022, 09:29 AM:

(private comment, text removed)

gerhard17 commented 5 months ago

I have a similar problem: Having a special Hosting-Assembly (AnyCPU) which can load and start either a 32- or 64-bit host process (exe). These two host processes are referenced by the Hosting-Assembly, so they are getting copied and the location can be extracted with e.g. typeof(Program32).Assembly.Location or typeof(Program64).Assembly.Location

It would be greatly welcomed to suppress the message for exactly these two host process assemblies.

The current warning is also propagated to other assemblies using the Hosting-Assembly, which I want also to suppress.

rainersigwald commented 5 months ago

@gerhard17 for your specific scenario, does the actual Hosting-Assembly need to directly reference the host process assemblies? In many such cases those would be invisible to ResolveAssemblyReferences by using <ProjectReference Include="..\x86host\x86host.csproj" ReferenceOutputAssembly="false" /> or similar.

gerhard17 commented 5 months ago

@rainersigwald Thank you for your input! Your idea is good, but i didn't achieve to get the hosting assemblies automatically get copied over into dependent projects. But i will hold that idea in mind!