I have an old website (asp.net 2.0) that is running on IIS7 on a server happily.
I want to make a change to the code, so I have copied all the source code and appropriate binaries to my desktop (running VS 2012).
However whether I am using IIS or the inbuilt webserver I am getting the following error;
The type 'foo' in 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\livesite\169c38ce\cc32b84b\App_Web_qbel5zk4.28.cs' conflicts with the imported type 'foo' in 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\livesite\169c38ce\cc32b84b\App_Web_m030ztdd.dll'. Using the one in 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\livesite\169c38ce\cc32b84b\App_Web_qbel5zk4.28.cs'.
This same code worked fine on an older XP PC running VS 2005. I am assuming that this is down to the .net framework, the app pool in iis is set to run as asp.net 2 classic, but the assemblies are being generated under v4 of the framework.
I have tried deleting temporary asp.net files and I am still getting the same issue.
There is only one instance of each of the classes it is objecting about in the project. So how do I fix it so that this works in VS 2012, but still using .net 2.0 ?
Maybe it is a matter of dynamic compilation. By default the "batch" attribute of the "compilation" element in your web.config is true. Something like this :
<compilation defaultLanguage="c#" debug="false" batch="true" targetFramework="4.0" />
With batch="true", whenever a control has to be compiled in a directory, the server compiles all controls (everything?) in its directory.
That may results in conflicts for elements referenced from different locations in your site.
You should try to set batch="false" and to remove your temporary files. If you still encounter problems, try to do a dummy edit-and-save on the corresponding ascx/cs files.
Hope this will help
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.