Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class Library Project File not compiling into .dll or debugging

Tags:

c#

dll

in my solution:

  • i have a class library project that compiles into a dll.
  • i have a web project.

(i have multiple solutions with different web projects but the same class library)

one of the files in the class project (utilities.cs) - all of a sudden won't compile into the .dll

i had made a change to this file, but the change wouldn't show on the website. so i put a breakpoint in the .cs file, and tried running it... breakpoint didn't get hit! eventually i put a breakpoint in the .aspx file that called the function. then i stepped the debugger one line on, so it would step into the .cs file, except i got the error:

"This source file has changed. It no longer matches the version of the file used to build the application being debugged."

so the code in utilities.cs is not being updated into the dll. which is weird, because code in my other .cs files IS being updated (i tried changing a few lines) and IS able to catch the debug.

any ideas how to fix this? or even what the cause of the problem is??

like image 977
Sean Avatar asked Dec 10 '09 11:12

Sean


3 Answers

Try:
Right click on Solution in Solution Explorer -> Properties -> Configuration Properties -> Make sure Build checkbox is checked for your class library.

like image 166
nightcoder Avatar answered Oct 22 '22 04:10

nightcoder


When You adding new references to Web project You must choose "Projects" tab:

Projects lists all reusable components created from local projects.

  1. Add or Remove References in Visual Studio
  2. Add a Reference to a Visual Studio Project in a Web Site

Always rebuild all projects in Release and Debug mode.

like image 44
Michał Ziober Avatar answered Oct 22 '22 05:10

Michał Ziober


You need to find out why the DLL will not build:

  • Look at the output window for any errors
  • Check the Errors window

Fix the errors and try building again.

The dll that you are trying to debug is from an older version of your code that did compile OK and the debugger pickes that up and is trying to debug against that - it is complaining because the code and the dll no longer match.

Try doing a Build -> Clean on the solution and then rebuilding to see the errors.

like image 35
Oded Avatar answered Oct 22 '22 05:10

Oded