Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Visual Studio 2010 publish website with source code?

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?
like image 888
Roc Ho Avatar asked Dec 26 '11 03:12

Roc Ho


People also ask

How do I Publish my website in Visual Studio?

In Solution Explorer, right-click your project and choose Publish. If you're publishing this web app for the first time, next you see the Publish wizard. Visual Studio filters the list of destinations depending on the type of web app.

What is the use of Publish in Visual Studio?

The Publish tool helps you deploy your application to various destinations. Get started by right-clicking your project in Solution Explorer and selecting Publish from the context menu.


1 Answers

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!

like image 97
enorl76 Avatar answered Sep 27 '22 18:09

enorl76