1

我正在尝试在本地运行时更改某些 appsetting 键的值。

所以,我有我原来的 Web.config 有那些键

<appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="config" value="Release" />
  </appSettings>

我正在尝试更改 web.debug.config 中“config”键的值,

<?xml version="1.0"?>

<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <appSettings>
    <add key="config" value="Debug" xdt:Transform="Replace" xdt:Locator="Match(key)" />
  </appSettings>

  <system.web>
  </system.web>
</configuration>

什么时候,我使用 VS 在本地运行项目:

在此处输入图像描述

我正在打印 config 的值,并且始终显示来自 web.config 的值,但是当我单击 web.debug.config 上的预览转换时,它显示如下:

在此处输入图像描述

如何通过从 web.debug.config 中选择信息使其在本地工作?

4

0 回答 0