开发者

Ambiguous dll parser error when trying to debug a project

开发者 https://www.devze.com 2023-02-22 01:25 出处:网络
I\'m getting the following error when I try to debug my MVC solution: Parser Error Description: An error occurred during the parsing of a resource 开发者_Go百科required to service this request. Ple

I'm getting the following error when I try to debug my MVC solution:


Parser Error Description: An error occurred during the parsing of a resource 开发者_Go百科required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The type 'HandiGamer.MvcApplication' is ambiguous: it could come from assembly 'C:\Users\Kevin\documents\visual studio 2010\Projects\HandiGamer\HandiGamer\bin\HandiGamer.DLL' or from assembly 'C:\Users\Kevin\documents\visual studio 2010\Projects\HandiGamer\HandiGamer\bin\HandiGamer.WebUI.DLL'. Please specify the assembly explicitly in the type name.

Source Error:

Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="HandiGamer.MvcApplication" Language="C#" %>

Source File: /global.asax Line: 1


This is the first time I've encountered this error with my project. All I've changed since the last time I debugged it was a .master page, a view, and I added a couple ViewModel classes. My solution has two projects - HandiGamer.WebUI and HandiGamer.Domain - but I've never encountered an ambiguity issue with them before. Rebuilding my solution did nothing. I'm not sure what else to do.


Have you renamed you assembly recently? In this case it can be that the old DLL is still in your bin folder ...\Projects\HandiGamer\HandiGamer\bin and is being loaded on runtime. As the error message tells you, the DLLs

HandiGamer.DLL
HandiGamer.WebUI.DLL

both contain HandiGamer.MvcApplication so the parser cannot decide which of them to take and is getting a conflict when you try to run it (compiling usually works fine with no errors, the issue typically occurs during runtime).

To resolve this, delete them from the bin folder above manually, then rebuild the entire solution. Unfortunately, 'Clean Solution' does not always clean up everything correctly so you have to do it sometimes by yourself.


Hint: If you unload the project (in Visual Studio: right-click the project, then select "Unload..."), you can edit the project file afterwards in the text editor and then search for assemblies there (to do that, right-click again on the unloaded project, then select "Edit...").

It contains all the references you have specified - but be careful not to mess it up. After you have searched and found the information you were looking for, close it and re-load the project. This is usually much faster than going though all entries in the References section of your project.


It looks like the MvcApplication class is defined in both assemblies in the HandiGamer namespace. Try opening them with Reflector to confirm this by searching for this class name. Then remove the duplicate class by leaving it only in your ASP.NET MVC application assembly. The other project must be a class library, not a web application.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号