Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The Type Class (in app_Code) exists in both "solution.dll" and "app_code.wxdafd.dll"

Tags:

I have made one webapplication in C#.net and make a app_code folder where one file in created

named "SessionHelper.cs" (property set correctly to "Compile" so that it can access in Webapplication)

it uses to set and get session parametes, when I try to debug it, gives me "Value" as below in "Watch window"

app_code.SessionHelper.IsURLCheckSupport(Name)      The type 'Solution.Web.app_code.SessionHelper' exists in both  'Solution.Web.dll' and 'App_Code.wgj24okr.dll'  (value) 

See below,

enter image description here

So i am not able to get the value while debug it, what can be the solution for this.

Please let me know, if you want more details.

like image 836
amit patel Avatar asked Feb 08 '12 08:02

amit patel


People also ask

What is App_Code?

The App_Code folder and its special status in an ASP.NET Web application makes it possible to create custom classes and other source-code-only files and use them in your Web application without having to compile them independently.

Why we use the App_Code folder?

You can store source code in the App_Code folder, and it will be automatically compiled at run time. The resulting assembly is accessible to any other code in the Web application. The App_Code folder therefore works much like the Bin folder, except that you can store source code in it instead of compiled code.


1 Answers

This is occuring because your project is a "Web Application", when you Compile in Visual Studio, all the code in your site (including in App_Code) gets compiled into an assembly called, in this instance, Solution.Web.dll. When you run your site, asp.net knows about a "special" folder called App_Code and compiles the content of it into an assembly with a unique name, in this instance `App_Code.wgj24okr.dll'.

One solution is to rename your App_Code folder to another name, such as Code.

like image 55
Rob Avatar answered Sep 26 '22 08:09

Rob