I'm running Microsoft Visual Studio Professional 2019 (Version 16.11.5) and am trying to get my application .dll and .pdb files to rebuild. This is an ASP.NET Web Application using the .NET Framework. Most solutions out there state that using "Clean Solution" will do it, but that choice is not available on the Build menu?
CodePudding user response:
Well, you only get that menu for a compiled project, or what we call a
asp.net web application
but, if you are using a
asp.net web site
Then you don't have a clean, and in fact the web site gets compiled on the fly by IIS and the web site - not Visual Studio.
So, if you using a asp.net web site application (and you should!!!), then you will see and get these options:
NOTE VERY VERY CAREFULL!!! - NO build web site!!!!!!!
However, if you open a web site, then you don't see those options. You see this:
Note in above - build web site. And note no clean application.
The "clean" option applies to both desktop, or web applications.
The difference?
Now, in most cases I MUCH prefer a web site application (but this makes single page code updates to the site MORE difficult, yet I still perfer that choice!!).
The list of differences between the two choices here are VERY long. But when you deploy, or run the application, then all pages (code behind) are taken and compiled down into a single application .dll (much like a desktop program). You also have MORE options such as being able to build and make a custom logon system (a custom authentication provider). And you have used a .sln (project file) to open this "applicaiton"
However, a LOT of people like using a asp.net web site. There are several reasons:
You can modify JUST one page save and not have to re-compile the whole site.
You can publish to a sub site, or "low cost" hosting
Your main page, application startup is NOT really a whole site,
but in effect just web pages being pushed up to a existing web site.
And even development is "easer" with a web site - you can modify one page (including code behind, hit ctrl-s to save, and you are done.
With a asp.net web application? You have to re-publish the WHOLE site again, even for a small one change to some code behind on a page.
So, as noted, did you open a "sln" file? = asp.net web site application
Or, did you just go open->open web site? = aspnet web site.
There is not going to be a "clean" option for asp.net web sites, since as noted, the IIS and web server will do the code compile for you, as opposed to a web site application, in which a set of .dll's are compiled into the bin file. (and in fact the main code behind gets compiled INTO ONE .dll with a "application"). As noted, with a application then publishing is more difficult, and you can't just update one page on the web site (code behind). With a asp.net web site, you can update the one page - and often some need or find this ability an advantage (I personally don't).
So to be really clear - a asp.net web site is NOT compiled by Visual Studio when run. With a asp.net web site application, the compile of the application occures first and THEN is passed to the IIS web server and then run - in that case, no on the fly compile of code occures, except for code app_code. So, as a result, I even use a foler called MyCode, since I don't want the web site to compile that code for me. (in fact, I had code break, since I started using vs2019 - and the newer "rosylyn editor - and it allow for example free strings such as sql statements in the code editor, but IIS can't compile them unless the web server .net compiler was upgraded to a later version).


