Reputation: 41442
Basically, what I'm wondering is if I need to set debug="false" before hitting the "Publish Web Site" button or if I can switch it after all the files have been published.
Upvotes: 3
Views: 572
Reputation: 1759
I hope this adds some value. I have been learning a lot about msbuild, and what a incredible tool it is!
If you are publishing sites to production, there is probably some of the steps that you would like to automate. If you want to use a batch file to do your publish instead of the visual studio interface, or included this in your build scripts, after you have compiled sucessfully the following will publish your website.
msbuild <yourProjectFile>.csproj
/target:"ResolveReferences;_CopyWebApplication"
/properties:"debug=false;
retail=true;
WebProjectOutputDir = <YourCorrectOutputDir>;
OutDir = <YourCorrectOutputDir>\bin\"
The time we have spent in our time, investing in fairly extensive build scripts, that even run a few basic http get reguests against the site after we are done building and publishing it, has reduced a huge amount of frustrations.
I am a firm beleiver of automating as much as possible, machines dont seem to forget to do things as often as I do :D
Hope it helps Cheers Rihan
Upvotes: 0
Reputation: 31630
You can keep it set to true when you publish/precompile, but once its at a production status, its strongly recommended that you set the value to false, the reasons are here outlined by Scott Guthrie (he manages the ASP.NET team) himself.
Highlights from Scott's post:
Doing so causes a number of non-optimal things to happen including:
1) The compilation of ASP.NET pages takes longer (since some batch optimizations are disabled)
2) Code can execute slower (since some additional debug paths are enabled)
3) Much more memory is used within the application at runtime
4) Scripts and images downloaded from the WebResources.axd handler are not cached
Upvotes: 1
Reputation: 1427
Unfortunately, no. You can publish it with the option set to true, although you certainly should not (if the page is going into production). I publish apps to a test environment initially with it set to 'true', the set it to false in the test environment, and absolutely to false when into production.
But your site will build and publish fine to whatever environment you send it to with the debug set to true. As I understand it, there are a quite a few sites out there that in production with this set that way. Dror posted a great link to the issues that come with leaving this option on.
Upvotes: 0
Reputation: 7303
As to what Ryan wrote - see debug code in production.
Another option you may want to use is retail="true".
Upvotes: 2
Reputation: 7543
On the production server you could put deployment retail=”true” in machine.config. This will ensure that debug is always false for that server. Details here.
Upvotes: 0
Reputation: 5976
You do not have to turn that setting off, however, you will want to set debug="false" before running the website as a production application. It will have a profound impact on your site's performance.
Upvotes: 4