Home > Backend Development > C++ > Why Does My C# Unit Test Fail with a 'Located Assembly's Manifest Definition Mismatch' Error?

Why Does My C# Unit Test Fail with a 'Located Assembly's Manifest Definition Mismatch' Error?

Patricia Arquette
Release: 2025-01-30 23:51:10
Original
838 people have browsed it

Why Does My C# Unit Test Fail with a

C#unit test failure: The definition of the program set list is not matched with

Question

When testing the unit test of the C# Windows Forms application, the following errors occur:

Although only version 1.2.0.203 is referenced in the project, the error is referenced by version 1.2.200. How to determine the source of this reference and which tools can help search for the old assembly version on the hard disk?
<code>System.IO.FileLoadException: 无法加载文件或程序集“Utility, Version=1.2.0.200, Culture=neutral, PublicKeyToken=764d581291d764f7”或它的某一个依赖项。找到的程序集的清单定义与程序集引用不匹配。</code>
Copy after login

Answer

.NET program set the loader facing two challenges:

It cannot find the 1.2.0.203 version of the referenced assembly set.

    It found version 1.2.0.200, but its list definition and expected reference conflict.
  • To solve this problem, make sure the correct program set version is available. This can be achieved by placing the assembly in the global assembly cache (GAC) or application path.
To add the program set to the GAC, please execute the following command:

In addition, please refer to the Microsoft document (

https://www.php.cn/link/56DE534CF589F6D0CA09630DB803ba00
<code>gacutil /i "path/to/my.dll"</code>
Copy after login
. This document may be updated, it is recommended to search the latest related Microsoft documentation.

The above is the detailed content of Why Does My C# Unit Test Fail with a 'Located Assembly's Manifest Definition Mismatch' Error?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template