我正在研究 msuild 并尝试通过 msbuild 脚本实现 web.config 转换。我添加了额外的 web.staging.config 和 web.production.config。当我尝试使用 msbuild tweb.xml /t等命令行运行目标时:tw /p:Configuration=staging;平台=AnyCPU
低于错误。请帮助我,我在做什么错误???
"E:\tweb.xml" (tw target) (1) ->
(_CheckForInvalidConfigurationAndPlatform target) ->
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(483,9)
: error : The OutputPath property is not set for project 'tweb.xml'. Please ch
eck to make sure that you have specified a valid combination of Configuration a
nd Platform for this project. Configuration='staging' Platform='AnyCPU'. You
may be seeing this message because you are trying to build a project without a
solution file, and have specified a non-default Configuration or Platform that
doesn't exist for this project. [E:\tweb.xml]
0 Warning(s)
1 Error(s)
下面是我的代码
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'staging|AnyCPU'">
<WebConfigReplacement>staging</WebConfigReplacement>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'production|AnyCPU'">
<WebConfigReplacement>production</WebConfigReplacement>
</PropertyGroup>
<PropertyGroup>
<TransformInputFile>D:\webTransdemo\deploye\Web.Temp.config</TransformInputFile>
<TransformFile>D:\webTransdemo\WebTransform\WebTransform\Web.$(WebConfigReplacement).config</TransformFile>
<TransformOutputFile>D:\webTransdemo\WebTransform\WebTransform\Web.config</TransformOutputFile>
<StackTraceEnabled>False</StackTraceEnabled>
</PropertyGroup>
<ItemGroup>
<OriginalWebConfig Include="D:\webTransdemo\WebTransform\WebTransform\Web.config"/>
<TempWebConfig Include="D:\webTransdemo\deploye\Web.Temp.config"/>
</ItemGroup>
<Target Name="tw" Condition="'$(Configuration)|$(Platform)' == 'Production|AnyCPU' Or '$(Configuration)|$(Platform)' == 'Staging|AnyCPU'">
<Copy SourceFiles="@(OriginalWebConfig)" DestinationFiles="@(TempWebConfig)" />
<TransformXml Source="$(TransformInputFile)"
Destination="$(TransformOutputFile)"
Transform="$(TransformFile)"
StackTrace="$(StackTraceEnabled)" />
<Delete Files="@(TempWebConfig)"/>
</Target>