Before I start I just want to mention I'm not developing with C#, but PowerShell. I'm using Ironman Software's PowerShell Pro Tools addon.
So when I create a new Powershell Windows Forms project and then load it later, I am getting the following error message:
There was a mismatch between the processor architecture of the project being built "MSIL"
and the processor architecture of the reference "C:\Windows\Microsoft.NET\Framework
\v4.0.30319\\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please
consider changing the targeted processor architecture of your project through the
Configuration Manager so as to align the processor architectures between your project
and references, or take a dependency on references with a processor architecture that
matches the targeted processor architecture of your project.
The additional colums:
Project: DemucsForm
Path: C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64
File: Microsoft.Common.CurrentVersion.targets
Line: 2352
Col: 6
Source: Build
Here's an image of the error:
After reading a bunch of other posts about this error (although none I've seen have a reference to the x86 version of mscorlib.dll) it seems that my project isn't technically "AnyCPU" because there is an x86 dependency, which again happens to be mscorlib.dll.
Some other posts suggested one solution of re-targeting the project to x86 in the Configuration Manager of VS but I don't want to do that. I'd like everything to be x64 bit compatible... though I question if that even matters since it's a PowerShell project.
Also, I'm not even given the option to select x64/x86 in the configuration manager:
The biggest mystery of all to me is why this even matters since I'm not actually "compiling" or "building" the project since it's PowerShell.
Here are my questions:
- Why are all my new PowerShell projects adding a dependency to the x86 version of mscorlib.dll from .NET Framework v4.0.30319? I didn't manually add any assemblies.
- If PowerShell Pro Tools is responsible for this, Why isn't a newer version of the mscorlib.dll assembly being referenced? Isn't .NET v4.0.30319 ancient?
- Does this message even matter? Can I safely ignore it?
- If it does matter, how can I resolve the problem? I can't find a way to remove this dependency.
- If it doesn't matter, how can I universally suppress this message for all future projects?
Lastly, I found a file that references the assembly. The path is:
[Solution Directory]\[ProjectName]\obj\Debug\[ProjectName].pssproj.AssemblyReference.cache
It's not a plaintext file because there are control characters everywhere, but I can see a bunch of different strings. The first one is mscorlib.dll. Here's an image of the file opened in Notepad++:
I've tried deleting it and then reopening the solution but it just gets created again. It's obviously a cache file (the file extension is literally .cache).
Can someone help me here? I really want to get to the bottom of this.
I really appreciate anyone who has read this... novel of a post, and would greatly appreciate any help resolving this issue, as well as an understanding of why this is even happening.


