Visual Studio 2010 web.config转换(TransformWebConfig目标) [英] Visual Studio 2010 web.config transformations (TransformWebConfig target)
问题描述
我正在尝试为转换编写单元测试,所以我正在运行:
I am trying to write unit tests for my transformations, so I am running:
msbuild migrationd-project.csproj/p:Configuration =发布/T:TransformWebConfig.
msbuild migrated-project.csproj /p:Configuration=Release /T:TransformWebConfig.
这适用于我在VS2010中创建的新项目,但不适用于该项目.我认为这是因为它最初是2008年的项目.我知道这应该在webplatformbuild中运行,但是我想做的就是运行转换,所以我可以抓住转换后的web.config,并运行一些单元测试以确保存在正确的值.
This works for a new project I create in VS2010, but doesn't in this project. I'm assuming it's because it was originally a 2008 project. I know this is supposed to run in a webplatformbuild whatever, but what I'm trying to do, is just run the transform, so I can grab the transformed web.config, and run some unit tests to make sure the right values exist.
在任何一个项目中我都没有看到TransformWebConfig被引用为目标,因此我不确定要寻找什么.
I don't see TransformWebConfig referenced as a target in either project, so I'm not sure what I'm looking for.
推荐答案
通过Microsoft.WebApplication.targets引用了TransformWebConfig,该Microsoft.WebApplication.targets引用了Microsoft.Web.Publishing.targets,其中包含您要使用的TransformWebConfig目标.
TransformWebConfig is referenced through Microsoft.WebApplication.targets, which references Microsoft.Web.Publishing.targets which contains the TransformWebConfig target you're after.
在不查看项目文件的情况下,我不知道您的项目出了什么问题.您介意附上吗? 可能值得检查项目是否引用了Visual Studio WebApplication目标的版本10:
I don't know what's the problem with your project without having a look at your project file. Do you mind to attach it? Might be worth to check whether the project references the version 10 of Visual Studio WebApplication target:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />)
代替:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
这篇关于Visual Studio 2010 web.config转换(TransformWebConfig目标)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!