I'm currently working in the web site project.I want to build project in release mode, that unfortunately saw visual studio does not have release mode for build and only have debug mode.
in web application project we see two option in build debug and release.
I want to know why web site project have debug mode in build.I was read about debug and release mode building that release mode have optimize code and have less overhead.
You need to set release meod by right clicking solution > property> in dialog change it release mode or direclty from the rop of vidual studio set it for the release , see below image marked with red
In web site projects pages are compiled dynamically upon first request. It will compile without debugging symbols unless you specify otherwise in the config file.
You cant change it with configuration manager neither you see it in its options.
In your web config file find these options
<system.web>
...
<compilation debug="true">
...
</compilation>
</system.web>
Set true to false then it will publish in release mode.
Hope it helps
Related
I have introduced a new web.config transform as web.test.config. But when I am running the application the values are still coming from Web.config file.
I followed the below article:
https://www.c-sharpcorner.com/article/transform-web-config-file-while-deploying-the-web-application-project/
and made the necessary changes.
Web.test.config
Web.config
Read:
ConfigurationManager.AppSettings["TestKey"];
I want to get the value from Web.config when I run as debug mode and want to get the value from web.test.config when I run as test configuration mode.
You can not run the application in test configuration mode in Visual Studio if that's what your meaning. You have to publish the app in test mode to get the transformation. Aka you can test your app in i.e IIS with your test configuration, but not directly in VS. You can however preview the transformation in VS.
Windows 8, VS2013 IIS8,5
I'm trying to connect to a local WEB API by connecting to processes w3pv.exe (Managed (v4.0.30319), 19). The website front end and back end is both running fine on my local IIS. Right after publishing my x86 web API to the local IIS i try to connect to the process, where the break point states "The Breakpoints will not currently be hit. No symbols where loaded for this document". My colleague' can without any problems debug from his local computer.
So far I have.
Reinstalled VS2013.
Checked All Debug Properties
-Project -> build: Define DEBUG constant check / Define TRACE constant check.
Generate serialization assembly = Auto. Advanced build settings -> Debug info = full
Enable Just My Code: Check, Use Managed Compatibility Mode: Check
Enable Edit and Continue : Check
Made sure all Debug mode is set and all project Configured to Active solution platform x86, marked Debug and Build.
Deleted all bin and obj folders, as well as pdb folder in C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
Reset IIS.
Set Select Code Type to Automatically determine the type of code to debug
Checked in IIS that .Net compilation -> Debug and Enable Prefetch is set to true.
And I still get the same error message. Anyone found anything in addition to this?
I have encountered similar problems many times while training new employees in our very complicated devenv, so here is our internal step by step instruction:
Don't panic
Make sure you attached the debugger to the correct process - you debug the plugin by launching VMS which is external app that has separate config file where the plugin path is stored, so when you change just your configuration Debug/Release it doesn't work.
Make sure you have symbols generated for the assembly Project properties->Build->Advanced->Output section
Make sure the build path hasn't changed. You may have accidentally changed the path and you may only think that the assembly you are trying to debug is the correct one.
Investigating the information you provided this is only help I can think of. My guess is the files you publish are not the files you're debugging locally.
RESOLVED (embarrassed)
A few day's ago, I downloaded the front-end code for the website from the VPN (GIT). I forgot to update the code-behind reference in the App.js file in the front end root. This, of course, referred to the API on the cloud, and not my local API.
This took me way to long to find out. But, at the same time, it's not a solution I've seen so far on the web.
Thanks for all your help.
Have tried adding this to web.config
<compilation debug="false" targetFramework="4.0">
</compilation>
but website still executes code in #if DEBUG when it shouldn't
*Wierdly the inline statement <% #if DEBUG %> on aspx files works but require also for .cs code.
NB development and live website on same box
#if directives in backend .cs files are handled by the C# compiler, not ASP.Net.
Set your project to the Release configuration so that that symbol is not defined when compiling the DLL in VS.
compilation debug element is not the same thing as DEBUG preprocessor directive.
You need to re-compile your website in Release mode.
What about binaries compiled with debug symbols?
One scenario that several people find very useful is to
compile/pre-compile an application or associated class libraries with
debug symbols so that more detailed stack trace and line error
messages can be retrieved from it when errors occur.
The good news is that you can do this without having the have the
switch enabled in production.
Specifically, you can use either a web deployment project or a web
application project to pre-compile the code for your site with debug
symbols, and then change the switch to
false right before you deploy the application on the server.
The debug symbols and metadata in the compiled assemblies will
increase the memory footprint of the application, but this can
sometimes be an ok trade-off for more detailed error messages.
http://weblogs.asp.net/scottgu/archive/2006/04/11/Don_1920_t-run-production-ASP.NET-Applications-with-debug_3D001D20_true_1D20_-enabled.aspx
Ensure the compile configuration to release as well. In Visual Studio, Build Menu > Configuration Manager and make sure "Release" is selected for all your assemblies, and/or is the active solution configuration.
Setting <compilation debug="true/false"> in Web.config seems to do things that you can also set in Visual Studio in Project properties, Build tab. Are they connected somehow? Does one of them takes precedence when compiling?
They are not connected. The compilation tag is ASP.NET only, while the project option one is for Windows Forms, console, WPF and so on.
ASP.NET compilation is so special, so you have to dive further to learn about every piece of it,
http://msdn.microsoft.com/en-us/library/ms178466.aspx
Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development.
In VS2008 (and earlier if I'm not mistaking) I have dropdown that lets me choose between Debug and Release mode. All well.
When I switch VS to Release, the debug attribute in my web.config files isn't set to false at all though.
Is this the way it is supposed to be? I am bound to forget to set it to the correct value on deploying.. What measures should I take to make sure this is working like it should?
This is one solution to this problem:
http://blog.aggregatedintelligence.com/2009/04/aspnet-never-again-fear-publishing-your.html
Well your web.config would probably be different for debug and release (connection string, passwords, etc...) but if it's not, look at a postbuild event which would copy over a different file.
Also check this blog post from Scott Guthrie.
Changing release mode will not change web.config, however when you build your web app, it will build the dll for only C# files in release mode where else your web.config's debug on/off is used by IIS to build debug/release version of ASPX markup files.
The build flavour just affects how the code is compiled, it does not affect your configuration files. So yes, to answer your question, this is how it is supposd to be.
The element is a good solution if you have access to the machine.config of your server, which hosts only production applications.
I usually modify the web.config file when generating the deployed files as part of the automated build process. For example web deployment projects can perform web.config section replacement. There are a number of reasons I don't like web deployment projects and I tend to do it with a simple VBS file that modifies the file using MSXML.
The answer you selected from Bobby is not correct. Visual Studio builds the files for you in release while you are in VStudio.
IIS compiles the code at startup with that setting when you deploy. Not the bin directory, but the App_Code and the code behind files.
You should precompile your app before deployment which will compile your code behinds and App_Code dir into dlls in the bin directory.
The deployment tools automatically switch that setting if you set the deployment tool to Release
I use web deployment projects. http://weblogs.asp.net/scottgu/archive/2008/01/28/vs-2008-web-deployment-project-support-released.aspx