C#/WPF/.NET The assembly manifest definition found does not match the assembly reference

vs window error

引发的异常:“System.Windows.Markup.XamlParseException”(位于 PresentationFramework.dll 中)
“初始化“CircularGauge.CircularGaugeControl”时引发了异常。”,行号为“288”,行位置为“23”。

Code location error

FileLoadException: 未能加载文件或程序集“CircularGauge, 
PublicKeyToken=null”或它的某一个依赖项。
找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)

solution one

A lot of bloggers on the Internet said that the versions were inconsistent or the dll was signed, but none of them solved my problem.

Finally, after my own research and use

clear online cache

Uninstall all versions of the installed application that may have strong-named assemblies of the same version with mage.exe -cc and reinstall that

solved the problem

path to mage.exe

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools

Open the command line ( 以管理员身份运行)
and enter the following command

"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\mage.exe" -cc

my run output

C:\Users\dengd>"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\mage.exe" -cc
已清除应用程序缓存。                                                                                                                                                                                                                            C:\Users\dengd>  

Exit the program before clearing and restart
insert image description here
~~~ In the end, my problem was not solved. If yours is solved, congratulations, if it is not solved, continue reading

(异常来自 HRESULT:0x80131040)

solution two

Finally, check the csproj, and the version number of CircularGauge.dll quoted is not configured.
insert image description here
The left side is the version number of the program list that uses the following software to open and analyze my running software. The right side is the configuration version number in the code. It is found that the right side is not configured, so add with the following code

Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL

By the way, the location of the ildasm software

"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\ildasm.exe"

final look

    <Reference Include="CircularGauge,Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>dll\MatreialDesignDll\CircularGauge.dll</HintPath>
    </Reference>

Remember to close the ildasm software when you use VS to run the project again, otherwise it will report an error that the process is occupied and cannot be started.
Some small partner problems should have been solved. If not, it is recommended to read my other article.
My problem is still not solved. The problem and The same as before, so I wonder if it has PublicKeyToken=nullsomething to do with
another article " C#/WPF/.NET third-party ddl strong signature solution (xxx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null) "

## Solution three

Use nuGet to install the latest official package,
insert image description here
search for your problematic dll and update the latest version

Guess you like

Origin blog.csdn.net/gao511147456/article/details/128166274
Recommended