Why is VisualStudio/Firefox giving me a YSOD from code in an excluded class?

70 views Asked by At

I excluded a class from my project (right-click > "Exclude from Project"); the file dutifully vanished from the Solution Explorer. Yet, when I run the app, it YSODs with an error in that excluded file.

How do I tell Visual Studio and/or Firefox (the browser the app is currently using) that I really meant it when I excluded the *.cs class from the project?

UPDATE

More strangeness similar to the above:

It seems that VS really gets confused with the combination of syntaxes occurring in a cshtml file. Although selecting a line of code and mashing Ctrl+K, C will comment the line, sometimes the comments don't seem to be respected.

To make a long story shorter (Wane Shorter beats out Wax Longer this time around), I was having problems with a page compiling and displaying but not loading jQueryUI (the elements were there, but the inputs that had been .datepicker()ed were not datepickering, and the inputs morphed via a custom plugin were also not morphing worth a hoot, let alone a holler.

It turns out that a line of code I had commented out was not seen as having been commented out; after I deleted the "using" line it needed, it wouldn't compile for that reason! I got this YSOD:

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: CS0103: The name 'duckbillReporterUtils' does not exist in the current context

Source Error:  

Line 58:             });
Line 59: 
Line 60:             //var platypiArray = '@duckbillReporterUtils.callingAllPlatypi()';

As you can see, the problem is a commented out line! I had to remove it to get the project to compile and run again!

1

There are 1 answers

6
OnoSendai On BEST ANSWER

Peter's suggestion is likely right - you may have an intermediate/debug object that still references the deleted class. Try to clean the solution.

Placeholder

Edit: And maybe you'll need to restart your local webserver as well. In this case, IIS Express:

enter image description here

According to MSDN: 'When you clean a build, all intermediate and output files are deleted, leaving only the project and component files. From the project and component files, new instances of the intermediate and output files can then be built.'