我有一个项目,我试图使用SlowCheetah.我已经在我的构建配置中创建了我的配置文件(Test.web.config)和我想要使用的所有转换(Debug_Mock.config,Debug_SQL.config,Release)我有一个后期构建事件应该复制转换后的文件进入另一个目录但找不到该文件
(错误xcopy退出代码4)
SlowCheetah似乎没有像我期望的那样转换文件并将其放在输出目录(bin文件夹)中.有没有人有任何想法,为什么它没有发生,也许在某处设置?
仅供参考:此过程适用于具有相同项目的另一台计算机.至于我可以告诉同样的设置.但我可能没有找到正确的地方.
xml config-transformation slowcheetah xdt-transform web.config-transform
我有这个web.config文件,其编译选项设置如下
Web.config文件
<configuration>
...
<system.web>
<compilation debug="true" targetFramework="4.5" />
...
</system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)
这是默认情况下Visual Studio为发布模式提供的内容.
Web.Release.config
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我正在将它用于MVC4项目.基于本教程,我希望当应用程序在发布模式下运行时,将提供js和css的缩小版本.但这似乎并不起作用,并且正在提供js和css的非缩小版本.另一方面,如果我在web.config中明确地将debug设置为false,则正确提供最小版本.
当应用程序在发布模式下运行时,似乎编译标签转换问题,但我不明白Web.Release.config中的相同内容有什么问题.
简而言之,我无法通过在发布模式下运行应用程序来进行捆绑和缩小工作.
asp.net asp.net-mvc asp.net-mvc-4 bundling-and-minification web.config-transform
我处于这样一种情况,我只想更新WCF端点的URL的一部分.现在,我们通过在每个"种类"中包含所有端点的不同配置来实现此目的.这很难管理.我想在web.config中设置一个转换来实现.
这些是文件的两个示例
开发
<endpoint address="http://servicesdev.host.com/RPUtilityServices/LogException.svc/restService"
behaviorConfiguration="restfulBehavior"
binding="webHttpBinding"
contract="Host.RP.Shared.Common.Services.Utility.Interfaces.IExceptionUtilityService"
name="LogService" />
Run Code Online (Sandbox Code Playgroud)
还有一些这些
分期
<endpoint address="http://servicessta.host.com/RPUtilityServices/LogException.svc/restService"
behaviorConfiguration="restfulBehavior"
binding="webHttpBinding"
contract="Host.RP.Shared.Common.Services.Utility.Interfaces.IExceptionUtilityService"
name="LogService" />
Run Code Online (Sandbox Code Playgroud)
不同之处在于servicessta与servicesdev.现在我也有serviceuat和servicesqa etcera.我想设置一个转换,只是将' dev ' 替换为' sta '等而不是整个块(使用xdt:Transform="Replace")
但是我该怎么做?
c# web-config .net-4.5 visual-studio-2012 web.config-transform
我要求不在源代码管理中存储任何敏感信息(例如用户名和密码).我们正在做一个.NET 4.5 MVC应用程序,所以我的计划是使用aspnet_regiis.exe和ASP.NET的内置功能来加密web.config.我在这里工作没有问题,但我遇到的问题是我还要加密转换(Web.Release.config等),因为它还包含敏感信息.我环顾四周,没有看到任何方法这样做.有谁知道这样做的方法?
在我工作的地方,我们根据需要以及登台和生产环境创建Azure网站和SQL数据库以用于开发目的.我们为每个发布配置文件创建一个web.config转换,以将数据库连接字符串更改为与该网站关联的数据库.
现在,我正在尝试创建一个需要对数据库进行更新的Azure WebJob.我通过右键单击Web应用程序项目并选择添加新的Azure WebJob来创建它.
我需要做的就是我需要它做的是SQL数据库连接字符串,它指向Web App正在使用的同一个数据库.我知道这些可以在Azure门户中设置并使用配置管理器获取,但我宁愿能够在WebJob的App.config中使用它并根据需要转换App.config.
我尝试使用Slow Cheetah,但似乎只能对Debug和Release配置进行转换.
我开始完成本博客中指定的步骤:http: //gunnarpeipman.com/2013/11/using-web-config-transforms-with-app-config-files/
它告诉您如何手动编辑.csproj文件以启用App.config转换.但是,这不是更好的解决方案,因为您必须手动编辑项目文件以进行所需的每个转换.
谁能告诉我如何实现这一目标?它甚至可能吗?或者有没有办法在我的web应用程序的web.config文件中共享值,我知道这些值将转换为我需要的值?
我正在尝试转换我的Web.config文件以添加发布版本的重写规则,但我收到了一个intellisense错误.
未声明" http://schemas.microsoft.com/XML-Document-Transform:Transform "属性.
Web.Release.config
似乎没有错误编译好.但是当我尝试发布时,我确实遇到了构建错误:
源文档中的任何元素都不匹配'/configuration/system.webServer/rewrite' 未声明
' http://schemas.microsoft.com/XML-Document-Transform:Transform '属性.
上面的第一行是错误,而第二行是警告.为什么这不起作用?
请注意,我的Web.config顶部确实包含该行<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
更新:
部署时的构建错误原因是由其他原因引起的.所以,事实上,它确实构建好,我可以部署.所以在这一点上,问题只是为什么出现这个Intellisense错误/警告.
我正在尝试将应用程序部署到AppHarbor并遵循他们关于如何修改我的web.config的说明,因此它使用他们的实例auf Sql server.
运行解决方案后,我收到主题中提到的错误:
Unrecognized attribute 'xmlns:xdt'. Note that attribute names are case-sensitive.
Run Code Online (Sandbox Code Playgroud)
我发现这个问题的唯一主题就是这个.但添加预构建行并删除obj文件夹并重建并没有带来任何解决方案.它在以下行继续遇到此异常:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
Run Code Online (Sandbox Code Playgroud)
先感谢您.
我们的ASP.NET Web Api项目有两个部署配置(.pubxml):
Web部署(1)工作得很好.对zip的Package部署失败,并出现以下错误:
Warning 3 No element in the source document matches '/configuration/system.identityModel' 20 10 MyWebProject
Error 4 No element in the source document matches '/configuration/system.identityModel/identityConfiguration' 21 10 MyWebProject
Run Code Online (Sandbox Code Playgroud)
查看详细日志,我可以看到它在Web.config转换期间失败了.
ParameterizeTransformXml: No element in the source document matches '/configuration/appSettings/add[@key='ida:AudienceUri']'
ParameterizeTransformXml: Not executing SetTokenizedAttributes (transform line 7, 9)
ParameterizeTransformXml: No element in the source document matches '/configuration/appSettings/add[@key='ida:Realm']'
ParameterizeTransformXml: Not executing SetTokenizedAttributes (transform line 10, 9)
ParameterizeTransformXml: No element in the source document matches '/configuration/appSettings/add[@key='ida:FederationMetadataLocation']'
ParameterizeTransformXml: Not executing …Run Code Online (Sandbox Code Playgroud) 我有一个常见的Web项目,用作几个"子"Web项目的基础.是否可以在项目之间应用web.config转换/合并?假设结构如下:
base project
- web.config
child project
- web.config
- transform.config
Run Code Online (Sandbox Code Playgroud)
是否可以进行预构建事件或类似事件,将基础项目web.config与子项目web.config合并?
我们正在尝试在构建部署系统中集成"构建一次,随处部署"模型.
MSDeploy为此创造了奇迹,通过CRC校验和比较显着缩短了构建时间,并且(在大多数情况下)使用参数化来根据我们部署的环境更改应用程序web.configs时,它也能正常工作.
我将这些参数中的大多数固定下来,但是无论我在parameters.xml文件中调用它们有多少种不同的方式,一些元素和属性似乎永远不会改变.我已经概述了三个这样的例子,这里是我试图改变的web.config文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="DbConnectionString" connectionString="Data Source=null;Initial Catalog=null;Trusted_Connection=no;User ID=user1;Password=pass*9;" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<customErrors mode="On" defaultRedirect="/Library/Error/PageNotFound.aspx">
</customErrors>
</system.web>
<applicationSettings>
<settings>
<setting name="service_Address" serializeAs="String">
<value></value>
</setting>
<settings>
</applicationSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
这是parameters.xml文件:
<parameter name="DbConnectionString" defaultValue="">
<parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/connectionStrings/add[@name='DbConnectionString']/@connectionString" />
</parameter>
<parameter name="customErrorsMode" defaultValue="">
<parameterEntry kind="XmlFile" scope="\\web.config$" match="configuration/system.web/customErrors/@mode" />
</parameter>
<parameter name="service_Address" defaultValue="">
<parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/applicationSettings/aim.Web.Properties.Settings/setting[@name='service_Address']/value" />
</parameter>
Run Code Online (Sandbox Code Playgroud)
这是相应的setParameters.xml文件:
<setParameter name="DbConnectionString" value="Data Source=dbserver;Initial Catalog=DB1;Trusted_Connection=no;User ID=user1;Password=pass*9;"/>
<setParameter name="customErrorsMode" value="Off"/>
<setParameter name="service_Address" value="https://myservice.asmx"/>
Run Code Online (Sandbox Code Playgroud)
我测试了每个XPath表达式,结果与任何其他工作参数完全相同,但上面似乎永远不会改变.
有没有人看到我在这里丢失的任何明显的东西?
asp.net ×5
web-config ×4
c# ×3
asp.net-mvc ×2
azure ×2
.net ×1
.net-4.5 ×1
app-config ×1
appharbor ×1
encryption ×1
msdeploy ×1
slowcheetah ×1
webdeploy ×1
xml ×1
xpath ×1