rohit gupta
rohit gupta

Reputation: 45

issue with .net assembly

I have created some class A.cs whose function is to be used in B.cs then B.cs is called in ASP.net webforms in codebehind. My files A.cs and B.cs is kept in App_Code folder.

The issue is if i call the function of B.cs in asp.net webform codebehind i get error that function is not defind are you missing an assembly? After researching on SO, i found to make class build action to compile. Though it solved the issue, but when i build the app i got error that my assembly is present in root as app_code and assembly.dll both

Then i reverted the process, and got same function not found issue.

I am seriously unable to figure out,How to solve this???

Upvotes: 0

Views: 98

Answers (3)

J0e3gan
J0e3gan

Reputation: 8938

It sounds like you may have defined the Gal.DB.Service class in both the ASP.NET web app (under App_Code) and in an assembly that the web app references (i.e. Gal.DB.Manager.DLL).

The class can only be defined once.

Upvotes: 1

Ray Cheng
Ray Cheng

Reputation: 12586

I run into this exact problem before. The way I fixed it is moving all the code files form App_Code folder to a Classes folder (or any folder of your choice) and then compile and fix the compiling errors. After, the error went away.

Upvotes: 1

MatthewMartin
MatthewMartin

Reputation: 33183

try clearing the temporary asp.net files, depending on what web server you are using, you'll want to stop, reset or kill it to release the files before deleting them.

It sounds like this is a web app, where asp.net makes its best guess about what needs to be compiled. If this compilation model causes too much trouble, web project might be easier in the long run.

Upvotes: 0

Related Questions