预览配置文件转换的工具 [英] Tools for previewing configuration file transformations

查看:123
本文介绍了预览配置文件转换的工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何工具或Visual Studio 2010扩展允许我查看配置文件转换的输出,而不必发布整个项目?直接执行转换的过程可以调用吗?

Are there any tools or Visual Studio 2010 extensions which allow me to view the output of a configuration file transformation short of having to publish the entire project? Is the process which performs the transformation directly invokable?

编辑

Edit

再进行一次Google搜索之后,我遇到了:

After a little more Googling I came across this:

第4步:从命令行为登台"环境生成新的转换后的web.config文件

通过以下方式打开Visual Studio命令提示符 要开始->程序文件–> Visual Studio v10.0 –> Visual Studio 工具–> Visual Studio 10.0命令 提示

Open Visual Studio Command prompt by going to Start --> Program Files –> Visual Studio v10.0 –> Visual Studio tools –> Visual Studio 10.0 Command Prompt

键入"MSBuild"到应用程序的路径 项目文件(.csproj/.vbproj)" /t:TransformWebConfig /p:Configuration = Staging",然后点击 输入如下所示:

Type "MSBuild "Path to Application project file (.csproj/.vbproj) " /t:TransformWebConfig /p:Configuration=Staging" and hit enter as shown below:

一旦转换成功 web.config的暂存" 配置将存储在obj下 ->项目根目录下的暂存文件夹(在解决方案资源管理器中,您可以 首先取消隐藏即可访问此文件夹 隐藏的文件):

Once the transformation is successful the web.config for the "Staging" configuration will be stored under obj -->Staging folder under your project root (In solution explorer you can access this folder by first un-hiding the hidden files) :

  • 在解决方案资源管理器中,单击按钮以显示隐藏文件
  • 打开Obj文件夹
  • 导航到您的活动配置(在当前情况下为暂存")
  • 您可以在此处找到转换后的web.config
  • In the solution explorer click the button to show hidden files
  • Open the Obj folder
  • Navigate to your Active configuration (in our current case it is "Staging")
  • You can find the transformed web.config there

您现在可以验证新 生成的暂存web.config文件具有 更改后的连接字符串部分.

You can now verify that the new staging web.config file generated has the changed connection string section.

来源:

Source: Web Deployment: Web.Config Transformation

这对我来说并不是一个完美的解决方案,因为它仍然需要构建整个项目-至少要使用他发布的命令.如果有人知道使用MSBuild命令跳过构建步骤的方法会有所帮助(尽管听起来不太可能).

This isn't really a perfect solution for me as it still requires building the entire project- at least with the command he posted. If anyone knows of way to skip the build step with the MSBuild command that would be helpful (although that sounds somewhat unlikely).

编辑2

Edit 2

我还在CodePlex上发现了这个配置转换工具,该工具提供了一些不错的功能来扩展转换过程.对于我正在寻找的功能,这是我所看到的最接近的工具,并且它将是开发可创建预览的扩展的一个很好的起点.它使用Microsoft.Web.Publishing.Tasks库执行转换,而不依赖于构建实际项目.

I also found this Config Transformation Tool on CodePlex, which offers some nice functionality to extend the transformation process. This is tool is the closest thing I've seen for the functionality I'm seeking and would be a great starting point for developing an extension which creates previews. It uses the Microsoft.Web.Publishing.Tasks library to perform the transformation and does not depend on building an actual project.

推荐答案

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆