问题标签 [web-config-transform]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
tfsbuild - TFS 2012 and web.config transforms
I am trying to have my TFS Build create the web.config transform associated with the configuration I selected for my build. When I run the build I check the web.config file no transforms have been applied. When I a publish from VS2012 the transform works correctly.
I have set up TFS 2012 (Update 2), and have a separate server for builds. I don't have VS2012 installed on the build server, but I copied the C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\ Web and WebApplications folders and files from my dev machine to the build server.
I have created some configurations in my project, and have added some tranforms to the associated web.{configname}.config.
I have created a build and set the Items to Build - Configurations to Build to one of the configurations in my project. I noticed that it only has Debug and Release, it didn't have any of the configurations I created. (Side question: Is that correct, or should it show all the configurations I created?)
So I run a build and check the output folder and the web.config has not applied the transforms. Is there anything else I need to do?
powershell - Powershell 脚本:提示文件(通过掩码)并在命令行中使用该文件
免责声明:我对 ps 的了解还不够,无法在合理的时间内完成此任务,所以是的,我要求其他人做我的肮脏工作。
我希望能够在不打开命令行的情况下运行 web.config 转换。
我在一个文件夹中有以下文件:
这就是我想要的:PS 文件应使用枚举当前目录.*\.(?<env>.*?)\.config
并让我选择<env>
我感兴趣的生成 web.config 的目录。在我的示例中,我将看到两个选项:“qa”、“production”。
在我(用户)选择环境后(假设它是“qa”,选择的环境存储为 $env,相应的文件名将存储为 $transformation)脚本应执行以下操作:
- 备份原件
web.config
为web.config.bak
- 执行以下命令:
.
ctt .exe 是一个基于 XDT 的工具,可以从命令行运行 web.config 转换。
visual-studio - pubxml XML to change a web.config value on web deployment
Suppose I have a web.config
parameter under <appSettings><add key="myParam" value="myValue"/></appSettings>
and I want to modify the value for myParam
depending on the publish profile I use, ie DEVELOPMENT.pubxml
and TEST.pubxml
for a web site deployment.
What is the most straightforward way to accomplish this? How do I specify in the pubxml
which keys I want to transform, where they are, etc?
Either a direct answer or a link to a resource that answers this question would be highly appreciated.
asp.net - 为网站添加配置转换
我们确实有很多旧网站是用 Visual Studio 中的 WebSite 选项而不是项目构建的。我现在要做的是,使用 TeamCity 和 Octopus 来简化我们的部署过程。对于 MVC 网站,我能够顺利实现,但网站让我很难过。我在这里遇到的第一个问题是,
在 Visual Studio 中,我们可以添加不同的配置(使用配置管理器)并添加转换文件。对于网站,我看不到添加新配置转换文件的选项。我不是 100% 确定这是设计使然,或者我可能禁用了某些导致此行为的配置?
同一行的第二个问题是,这是否是设计使然,而不是为什么(只是好奇)?对于不同的部署场景,我们如何克服相同的问题,以所需的方式转换配置文件?
非常感谢您的时间和投入。
asp.net - How can I stop config transformation inserts being inserted twice?
Like most people I'm using teamcity as a CI tool and I'm also using web config transformations quite heavily, a lot of times to insert config values.
My build process is generally to build the entire solution and then (using msdeploypublish) deploying the website to a website.
Because I'm running msbuild twice, the config transformations are being run twice and so I'm ending up with duplicate values in the final versions of the config files (mainly web.config but I have others as well).
Is there a way to only run the config transformations the one time, for example by using a parameter in msbuild that will stop it from happening?
asp.net - Referenced project app.config transform with SlowCheetah
I have a ASP.NET MVC 4 web project
WebUI
that references a ASP.NET 4 Code Library
DAL
The Code Library has a reference to the SlowCheetah
2.5.5 NuGet package and is setup with several transformations for it's App.Config
.
The WebUI
is using the normal Web.Config
transformations but I have also added a reference to SlowCheetah
as a test for my problem but it didn't change my issue.
When I publish using
MS Web Deploy
in Visual Studio 2012 or when I publish straight to
File System
using a QA
configuration the correct Web.QA.config
is put in the root of my website, however the referenced class library configuration is not working, I get a sql connection error on the home page which alerts me that the correct App.Config
transformation is most likely not being used for the referenced DAL
project.
I thought this would be a .dll.config
file in the bin
folder for the WebUI
, but I am not too sure as I have this working on another web server where I manually changed the default App.Config
and Web.Config
files and there is no .dll.config
file present in the root bin
directory of the website.
Anyone know how to get this working?
UPDATE:
Examples below:
DAL
Code Library project App.Config
Part of Web.Config
from my WebUI
project
I use a Settings.settings file for each project.
How can I merge the App.Config connection into my Web.Config so that it is transformed during publishing? preferably I would want it to just use the one connection when publishing to the web.
At the moment the DAL
referenced project works on the web application if I set the app.config
correctly (which only makes some sense to me since its a referenced .dll).
Does adding this DAL.Properties.Settings.DefaultConnection
connection to my web.config
replace the one the DAL
is using?
msbuild - WebAPI 项目似乎没有将转换后的 web.config 发布到 bin 文件夹?
我在 .NET 配置转换方面做得很好。我现在将它们放在用于数据使用的类库和 WPF 应用程序中。
但是,当我尝试使用 ASP.NET WebAPI 项目设置它们时,似乎发生了一些奇怪的事情。
配置文件永远不会出现在我的 bin 目录中,因此 web.config 始终显示为预先形成的配置文件。
如果我在 csproj 上使用“/t:TransformWebConfig /pConfiguration=Test”的参数运行 MSbuild,我会看到以下内容:
CollectWebConfigsToTransform:找到以下配置转换:Areas\HelpPage\Views\Web.config、Web.config、Views\Web.config、bin\Web.config PreTransformWebConfig:跳过将 Web.config 复制到 obj\Test\TransformWebConfig\original\ Web.config,文件 obj\Test\TransformWebConfig\original\Web.config 是最新的 跳过复制 C:\Users\killesj1\Repositories\MRP Trunk\Macro Projects\VEUploader\src\app\VEUploader.WebAPI\Web.config到 obj\Test\TransformWebConfig\original\bin\Web.config,文件 obj\Test\TransformWebConfig\original\bin\Web。配置是最新的 TransformWebConfigCore:跳过目标“TransformWebConfigCore”,因为所有输出文件相对于输入文件都是最新的。TransformWebConfigCore:跳过目标“TransformWebConfigCore” 因为所有输出文件相对于输入文件都是最新的。PostTransformWebConfig:使用 Web.Test.config 将 Web.config 转换为 obj\Test\TransformWebConfig\transformed\Web.config。使用 C:\Users\killesj1\Repositories\MRP Trunk\Macro Projects\VEUploader\src\app 转换 C:\Users\killesj1\Repositories\MRP Trunk\Macro Projects\VEUploader\src\app\VEUploader.WebAPI\Web.config \VEUploader.WebAPI\Web.Test .config 到 obj\Test\TransformWebConfig\transformed\bin\Web.config。
似乎转换正在转换文件,但不知何故,它并没有回到旧 Web.config 所在的 bin 目录中。
这是正常的吗?我怎样才能让它表现得与其他网络转换相似?
msbuild - 在 Web.Config 转换中指定机器名称
我正在使用 Web.config 转换成功地创建我的 web.config 的调试和发布版本 - 这工作正常。
我很想知道是否有一个“机器名称”属性来指定我可以在调试 URL 中使用的当前机器名称,而不是硬编码特定的机器名称(在这种情况下,使用 localhost 不是一个选项) ,例如
是否有使用 Web.config 转换的可用属性?类似于 MSBuild 的$(ComputerName)
属性?
xml - 当目标配置文件的结构未知时如何处理深度 XDT 转换?
我正在尝试使用 XDT 转换为我的 NuGet 包创建 web.config 安装程序。
我想转换 web.config 文件:
看起来像这样:
以下是我尝试过的转换:
变换#1:
这仅在目标 web.config 已经包含一个<httpHandlers />
部分时才有效。
在上面的示例中(注意,没有<httpHandlers />
部分),这会导致错误:
源文档中没有元素匹配“/configuration/system.web/httpHandlers/add”
变换#2:
这在上面的示例中按预期工作,但是给定一个带有预先存在的<httpHandlers />
部分的 web.config 文件,该部分是重复的。
请记住,这是针对 NuGet 包的,我无法对用户配置的状态做出假设。
我是 XDT 变换的新手,所以可能错过了一些明显的东西。
c# - web.config 文件在 C# 中是如何工作的?
假设在我的主要启动项目中,我有一些设置的 web.config 文件:
该项目有两种配置:Release 和 Debug。每个都将此设置转换为自己的值,例如 web.Debug.config:
当我编译它时,没有转换的配置文件。我只有三个文件:web.config、web.Debug.config 和 web.Release.config。