I am getting this error.
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1704: An assembly with the same simple name 'MyMVCAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null has already been imported. Try removing one of the references or sign them to enable side-by-side.
My solution has 2 ASP.Net MVC projects - splitting the main content and the areas. The main project doesn't have a reference to the 2nd one. Instead, it gets all MVC DLL's in the folder and stores it into the IOC container, which takes care of registering all the controllers.
I get the error when I set the output of my 2nd ASP.Net MVC project into the bin folder of the main one. (I've set all my views in the Areas solution to Copy Always.)
I also tried post-build action of copying the DLL into the main bin instead of setting the output, but the results are the same.
What should I do?
In addition, I have the following setup:
- It is set to use the Local IIS Server instead of the VS Dev Server.
- In the Output window, I see that the local web server is loading all the DLL's from the GAC and Temporary ASP.Net files folder. The problem I see is that it is also trying to load my DLL file from my Solutions folder.
Any ideas why it is trying to get that sole DLL from the Solution too? It doesn't have that behaviour for the other projects.
UPDATE:
Here's a strange behaviour:
[1] I clear all copies of the offending assembly.
[2] I removed the post-build action that copies that assembly to my main MVC project bin folder.
[3] I run the main project. It works without any issues, but of course the missing assembly does not get loaded.
[4] I manually copy that assembly to the mian MVC project bin folder.
[5] I run the solution. It is getting the error again!
Can someone explain why it is trying to load this very same assembly from two different places?
Ok this may be a clue to the problem: Because I am copying the assembly to the main MVC project's bin folder, it is also getting copied into the Temporary ASP.NEt folder. At the same time, because the project is not being referenced by any other project in the solution, it is also copying the same assembly into IIS. How can I prevent this from happening? If I exclude the step of copying the assembly into the main MVC bin, it does not get loaded into IIS at all. Why is it behaving that way?