次の方法で共有


MSB3273

The complete error is similar to the following:

Unknown processor architecture. The implementation file "filename" for "WinMD file" had an ImageFileMachine value of "hex value". If you wish to use this implementation file make sure the "ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch" property in your project is set to "Warning" or "None".

The WinMD file is the Windows Metadata file, which contains type information for UWP or WinRT applications that enables language projection. See WinMD files. The ImageFileMachine refers to an enumeration value that indicates the platform architecture.

A typical reason for the error is when there's a conflict between your platform architecture for an assembly and its dependencies, such as when your assembly's architecture is set to AnyCPU but you have a platform-specific (say x86) dependency.

As suggested in the error text, you can change this error into a warning. You can do that by setting the property ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch to Warning or None.

<PropertyGroup>
   <!-- other property settings -->
   <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>

If you use this technique to suppress the error, your code must ensure that dependencies are never loaded in a context where they would run on the wrong architecture.