Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Web.debug.config in the built-in visual studio debugger server?

How can I merge and make use of Web.debug.config in visual studio 2010 built-in debugger?

like image 522
stacker Avatar asked Jul 22 '10 01:07

stacker


People also ask

How do I enable debugging in web config?

In the Web. config file, locate the compilation element. Debugging is enabled when the debug attribute in the compilation element is set to true. Change the debug attribute to false to disable debugging for that application.

How do I set Debug configuration in Visual Studio?

In Solution Explorer, right-click the project and choose Properties. In the side pane, choose Build (or Compile in Visual Basic). In the Configuration list at the top, choose Debug or Release. Select the Advanced button (or the Advanced Compile Options button in Visual Basic).

Where is the web config file in Visual Studio?

config file is located in the %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\ folder. The default settings that are contained in the Machine.


2 Answers

This is a known bug. That feature can be used right now only as part of the deploy process.

https://connect.microsoft.com/VisualStudio/feedback/details/523221/have-web-debug-config-apply-during-development

Please upvote it, if you encounter this too, so this will be fixed ASAP.

like image 114
stacker Avatar answered Sep 27 '22 18:09

stacker


This is actually quite simple to do and, believe it or not, it seems this is the way VS is designed to work.

Add the following lines verbatim right before the closing "Project" tag of the .csproj file of the project that contains web.config.

<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" /> <Target Name="Transform">     <MakeDir Directories="obj\$(Configuration)" Condition="!Exists('obj\$(Configuration)')" />     <TransformXml Source="Web.Config" Transform="Web.$(Configuration).config" Destination="obj\$(Configuration)\Web.config" StackTrace="true" /> </Target> 

Put the following lines verbatim to the post-build event in the project properties of the project that contains the web.config file. Do this for each build configuration you want the transformations to run for.

"$(MSBUILDBINPATH)\msbuild" "$(ProjectPath)" /t:Transform /p:Configuration=$(ConfigurationName);Platform=AnyCPU xcopy "$(ProjectDir)obj\$(ConfigurationName)\Web.Config" "$(ProjectDir)". /F /R /Y 
like image 38
stuckintheshuck Avatar answered Sep 27 '22 19:09

stuckintheshuck