debug config

This commit is contained in:
Luc Vandenbroucke 2020-05-05 13:15:17 +02:00
parent 75ce7fac70
commit 8cc0977284
12 changed files with 147 additions and 68 deletions

15
TextFile1.txt Normal file
View file

@ -0,0 +1,15 @@
Here's what we do. It's not hard to set up but not intuitive or well documented.
Create web.config.template. No build action, do not copy. Copy-paste your web.config contents here. (This is an arbitrary name, no black magic.)
Right-click and select "Add Transform". This will get you files like Web.config.Debug.template and Web.config.Release.template. Add your transforms here.
Unload your project (right-click on project, select "Unload Project")
Open the .csproj file (right-click on closed project, select "Edit .csproj"
Add the XML below to the bottom of the file (just before )
Build the project. This should create a web.config file, but you still need to add it to the project.
Click "Show All Files"
Right-click the new web.config that was created and select "Include in Project"
Delete and transform files that were added automatically under web.config
<Target Name="BeforeBuild">
<TransformXml Source="Web.config.template" Destination="Web.config" Transform="Web.config.$(Configuration).template" />
</Target>
Now when you build, you'll get a shiny new web.config that is the result of the transformation.
Be sure to add the .template files to source control, and exclude the actual web.config. I also put a big warning at the top of Web.config.template to only edit the .template files, not the actual web.config, or your changes will be overwritten.

View file

@ -268,17 +268,32 @@
<ItemGroup>
<Content Include="favicon.ico" />
<Content Include="rems.css" />
<Content Include="web.config" />
<Content Include="web.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Site.master" />
<Content Include="libman.json" />
<None Include="packages.config" />
<None Include="Properties\PublishProfiles\eDosTest.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<None Include="web.Debug.config">
<DependentUpon>web.config</DependentUpon>
<Content Include="web.config.template">
<TransformOnBuild>true</TransformOnBuild>
</Content>
<None Include="web.config.Debug.template">
<DependentUpon>web.config.template</DependentUpon>
<IsTransformFile>true</IsTransformFile>
</None>
<None Include="web.Release.config">
<DependentUpon>web.config</DependentUpon>
<None Include="web.config.eDosTest.template">
<DependentUpon>web.config.template</DependentUpon>
<IsTransformFile>true</IsTransformFile>
</None>
<None Include="web.config.FolderProfile.template">
<DependentUpon>web.config.template</DependentUpon>
<IsTransformFile>true</IsTransformFile>
</None>
<None Include="web.config.Release.template">
<DependentUpon>web.config.template</DependentUpon>
<IsTransformFile>true</IsTransformFile>
</None>
</ItemGroup>
<ItemGroup>
@ -329,4 +344,7 @@
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
</Target>
<Target Name="BeforeBuild">
<TransformXml Source="Web.config.template" Destination="Web.config" Transform="Web.config.$(Configuration).template" />
</Target>
</Project>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
-->
<connectionStrings>
<add name="eDosConnectionString"
connectionString="Data Source=sqlsrv3;Initial Catalog=eDos;Integrated Security=True" providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>

View file

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
-->
<connectionStrings>
<add name="eDosConnectionString"
connectionString="Data Source=HPHDB;Initial Catalog=eDos;Integrated Security=True" providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="HPH_REMS_newConnectionString" connectionString="Data Source=sqlsrv3;Initial Catalog=HPH_REMS_new;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="eDosConnectionString" connectionString="Data Source=HPHDB;Initial Catalog=eDos;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="eDosConnectionString" connectionString="Data Source=sqltest2;Initial Catalog=eDos;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="RemsConnectionString" connectionString="Data Source=REMSDB;Initial Catalog=Rems;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--For more information on using transformations see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="eDosConnectionString"
connectionString="Data Source=sqltest2;Initial Catalog=eDos;Integrated Security=True" providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
</configuration>
<!--ProjectGuid: 7EC1704D-587D-4AD8-87B0-498C958EBF3C-->

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!--For more information on using transformations see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
</configuration>
<!--ProjectGuid: 7EC1704D-587D-4AD8-87B0-498C958EBF3C-->

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--For more information on using transformations see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="eDosConnectionString"
connectionString="Data Source=HPHDB;Initial Catalog=eDos;Integrated Security=True" providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
</configuration>
<!--ProjectGuid: 7EC1704D-587D-4AD8-87B0-498C958EBF3C-->

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--For more information on using transformations see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="eDosConnectionString"
connectionString="Data Source=HPHDB;Initial Catalog=eDos;Integrated Security=True" providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
</configuration>
<!--ProjectGuid: 7EC1704D-587D-4AD8-87B0-498C958EBF3C-->

67
eDos/web.config.template Normal file
View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="eDosConnectionString" connectionString="Data Source=sqltest2;Initial Catalog=eDos;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="RemsConnectionString" connectionString="Data Source=REMSDB;Initial Catalog=Rems;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="Telerik.Web.UI.RenderMode" value="Classic" />
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
<add key="Telerik.Skin" value="WebBlue" />
<add key="Telerik.ScriptManager.TelerikCdn" value="Enabled" />
<add key="Telerik.StyleSheetManager.TelerikCdn" value="Enabled" />
</appSettings>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
The following attributes can be set on the <httpRuntime> tag.
<system.Web>
<httpRuntime targetFramework="4.6.1" />
</system.Web>
-->
<system.web>
<authentication mode="Windows" />
<identity impersonate="true" />
<customErrors mode="Off" />
<compilation targetFramework="4.7.2" debug="true" />
<httpRuntime targetFramework="4.7.2" maxRequestLength="4096" executionTimeout="110" />
<pages>
<controls>
<add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" />
</controls>
</pages><httpHandlers>
<add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
<add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" /></httpHandlers><httpModules /></system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4194304" />
</requestFiltering>
</security>
<defaultDocument>
<files>
<add value="TaskBG.aspx" />
</files>
</defaultDocument>
<validation validateIntegratedModeConfiguration="false" /><handlers>
<remove name="ChartImage_axd" />
<remove name="Telerik_Web_UI_SpellCheckHandler_axd" />
<remove name="Telerik_Web_UI_DialogHandler_aspx" />
<remove name="Telerik_RadUploadProgressHandler_ashx" />
<remove name="Telerik_Web_UI_WebResource_axd" /><add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode" />
<add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode" />
<add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode" />
<add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode" />
<add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode" />
</handlers></system.webServer>
</configuration>
<!--ProjectGuid: 7EC1704D-587D-4AD8-87B0-498C958EBF3C-->

View file

@ -5,6 +5,11 @@ VisualStudioVersion = 15.0.27703.2018
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eDos", "eDos\eDos.csproj", "{7EC1704D-587D-4AD8-87B0-498C958EBF3C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E3FA148E-447D-4C65-B5E5-E24EB082D34C}"
ProjectSection(SolutionItems) = preProject
TextFile1.txt = TextFile1.txt
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU