Why is Visual Studio 2010 publishing a source code website?

I am using Visual Studio 2010 with a new website publishing dialog box. I have a web application. When it is published, theoretically it should compile all the code into a single assembly. However, after publication in Debug and Release , the directory always contains the source code of the page and user controls (even with untransformed web.config files Web.Debug.config and Web.Release.Config). This is very confusing.

But with the package/publish web project configuration and the Generate Deploy package context menu item, the Package \ PackageTmp directory is clean.

  • Why is Visual Studio not using this package to publish a website?
  • Where is the precompilation option?
  • The xml conversion of Web.config doesn't seem to work, why is Visual Studio bringing this feature to confuse me?
+7
source share
3 answers

The correct answer is to look in the settings of the Package / Publish on the Internet (in the properties of the web application project) and find the "Elements for deployment".

enter image description here

For a web application, you want the "Items to Deploy" to have "Only the files necessary to run this application", which did NOT copy the source code files because they were compiled into a DLL in the bin folder.

Please note that this parameter changes for your current build type (Debug / Release / etc), so plan accordingly ...

Ciao!

+11
source

You need to understand the differences between Web Application Projects and Web Site Projects .

To deploy a web application project, you copy the assembly that was created by compiling the project on the IIS server. Unlike deploying a website project, you usually copy the project source files to the IIS server.

For web application projects, a project is usually created in Visual Studio or using an ASP.NET batch compiler on a computer, it is not a production IIS server. All class files for the code and stand-alone class files in the project are compiled into one assembly, which is then placed in the project of the Bin web application folder. (The .aspx and .ascx files are compiled dynamically in the way it is done for website projects.)

For website projects, you do not need to manually compile the project. Website projects are usually dynamically compiled by ASP.NET (both on the development computer and on the production IIS server). You can choose a batch compilation mode that usually creates one assembly for each folder and a fixed compilation mode that usually creates one assembly for each page or user control.

+2
source

In visual studio 2013/2015, select the option "Precompile while publishing" enter image description here

0
source

All Articles