7

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

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

  • Why doesn't Visual Studio use this Package to publish the website?
  • Where is the precompile option?
  • Web.config xml transform seems not work, why does Visual Studio bring this feature to confuse me?
3
  • Is it a web application or a web site? Do you see only .as?x files or also .cs files?
    – SLaks
    Dec 26, 2011 at 3:56
  • @SLaks I'm sure it's Web Application not Web site.I already solved,just because I set Include all project files in Package/Publish web configuration
    – Roc Ho
    Dec 26, 2011 at 11:56
  • hi @RocHo me too have the same problem but the thing is i am publishing the WEBSITE and not the webapplication in VS2013 Professional Edition. When i publish it also publish the SOURCE CODE and not jst the binaries/dll. So, will u please suggest me any solution to publish files in .aspx/.dll files only? Feb 27, 2015 at 6:11

3 Answers 3

11

The correct answer is to look in the Package/Publish Web settings (in the web application project properties) and look for the "Items to deploy".

enter image description here

For a web application you'd want "Items to deploy" to have "Only files needed to run this application" which would NOT copy the source code files, since they've been compiled into the DLL in the bin folder.

Note that this setting varies for your current Build type (Debug/Release/etc), so plan accordingly...

Ciao!

2
  • hi @enorl76 please suggest me any solution for the above comment? help appreciated! I tried your solution but unfortunately unable to locate this option in VS 2013 professional edition. :( Feb 27, 2015 at 6:12
  • @SHEKHARSHETE i have VS 2013, and I just looked and its the same. Perhaps you are trying to use a different project type? You have to be using a Web Application project type.
    – enorl76
    May 10, 2016 at 14:18
2

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

To deploy a Web application project, you copy the assembly that is created by compiling the project to an IIS server. In contrast, to deploy a Web site project, you typically copy the project source files to an IIS server.

For Web application projects, you typically build the project in Visual Studio or by using the ASP.NET batch compiler on a computer that is not the production IIS server. All code-behind class files and standalone class files in the project are compiled into a single assembly, which is then put in the Web application project's Bin folder. (The .aspx and .ascx files are compiled dynamically in a manner similar to what is done for Web site projects.)

For Web site projects, you do not have to manually compile the project. Web site projects are typically compiled dynamically by ASP.NET (on both the development computer and the production IIS server). You can choose between batch compilation mode, which typically produces one assembly per folder, and fixed compilation mode, which typically produces one assembly for each page or user control.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.