我正在運行 Microsoft Visual Studio Professional 2019(版本 16.11.5)并試圖重建我的應用程式 .dll 和 .pdb 檔案。這是一個使用 .NET Framework 的 ASP.NET Web 應用程式。大多數解決方案都宣告使用“清潔解決方案”可以做到這一點,但該選項在“構建”選單上不可用?
uj5u.com熱心網友回復:
好吧,你只能得到一個編譯專案的選單,或者我們所說的
asp.net web application
但是,如果您使用的是
asp.net web site
然后你沒有一個干凈的,實際上網站是由 IIS 和網站動態編譯的 - 而不是 Visual Studio。
因此,如果您使用 asp.net 網站應用程式(并且您應該!!!),那么您將看到并獲得以下選項:

注意非常非常小心!!!- 沒有建立網站!!!!!!!
但是,如果您打開網站,則看不到這些選項。你看到這個:

上面的注意事項 - 建立網站。并注意沒有干凈的應用程式。
“干凈”選項適用于桌面或 Web 應用程式。
區別?
現在,在大多數情況下,我更喜歡網站應用程式(但這會使網站的單頁代碼更新更加困難,但我仍然更喜歡這種選擇!!)。
這里兩個選擇之間的差異串列很長。但是,當您部署或運行??應用程式時,所有頁面(背后的代碼)都會被提取并編譯成單個應用程式 .dll(很像桌面程式)。您還有更多選項,例如能夠構建和制作自定義登錄系統(自定義身份驗證提供程式)。您已經使用 .sln(專案檔案)打開了這個“應用程式”
但是,很多人喜歡使用 asp.net 網站。有幾個原因:
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.
甚至網站的開發也“更輕松”——你可以修改一個頁面(包括后面的代碼,點擊 ctrl-s 保存,你就完成了。
使用 asp.net 網路應用程式?您必須再次重新發布整個站點,即使對頁面上的某些代碼進行微小的更改。
所以,如前所述,您是否打開了“sln”檔案?= asp.net 網站應用程式
或者,您是否只是打開-> 打開網站?= aspnet 網站。
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).
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/418278.html
標籤:
