[英]excluding web.config with msbuild
我下面有由團隊城市執行的msbuild。 我想排除web.config但不能。 在下面的代碼中,您可以看到我添加了代碼,但沒有用。 我對msbuild和teamcity完全陌生
<property name="solution.dir" value="." />
<property name="SolutionFileName" value="MyProj.sln" />
<property name="projectfile" value="${solution.dir}\MyDir\Myproj.csproj" />
<property name="MSBuildPath" value="C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" />
<ItemGroup>
<MyProjectReferences Exclude="web.config" />
</ItemGroup>
<target name="build" depends="clean,UpdateBuildVersion,compile" />
<target name="clean" description="delete build artifacts">
<property name="build.base" value="${solution.dir}/_deploy/" />
<property name="dir.publish" value="${build.base}/publish" />
<property name="dir.package" value="${build.base}/package" />
<property name="project.fullversion" value="1.0.0.1" />
</target>
<target name="compile" description="compile">
<exec program="${MSBuildPath}" failonerror="true">
<arg value="${projectfile}" />
<arg line="/p:Configuration=Release" />
<arg line="/p:UseWPP_CopyWebApplication=True" />
<arg line="/p:PipelineDependsOnBuild=False"/>
<arg line="/t:Rebuild" />
<arg line="/t:Package" />
<arg line="/p:IncludeAppPool=true" />
<arg line="/p:PackageLocation=${solution.dir}/../publish/package/Myproj.zip" />
<arg line="/P:DeployIisAppPath=website/MyProj" />
<!--<arg line="-skip:objectName=filePath,absolutePath=.*web\.config"></arg>-->
</exec>
</target>
有人可以指出我正確的方向嗎?
好的,首先,構建的語法尚待完善。 但是您是msbuild的新手。 因此,我試圖根據您在此處給我們提供的信息來解釋您需要什么。
所以這是您的腳本有些重新解釋:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="Choose something else here too">
<PropertyGroup>
<SolutionDir>C:\Some\Path\Where\You\Keep\your\Solution\</SolutionDir>
<BuildDir>C:\Some\Path\where\your\build\goes\that\is\outside\of\your\repo\</BuildDir>
</PropertyGroup>
<ItemGroup>
<MyProject include="$(SolutionDir)MyDir\MyProj.csproj" >
<Properties>Condiguration=Release;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False;IncludeAppPool=true;PackageLocation=$(SolutionDir);DeployIisAppPath=website\MyProj</Properties>
</MyProject>
</ItemGroup>
<Target name="clean">
<!-- The best thing to do is to call msbuild with the clean target. -->
<MSBuild Projects="@(MyProject)" Targets="Clean" />
<!-- Then delete anything else you want to -->
<Delete Files="" />
<!-- I like to just delete the build directory for cleaning -->
<RemoveDir Directories="$(BuildDir)" />
</Target>
<Target name="updateBuildVersion">
<!-- Do what ever you need to here. -->
</Target>
<Target name="Build" DependsOnTargets="clean;updateBuildVersion">
<MSBuild Projects="@(MyProject" Targets="Build" StopOnFirstFailure="true" />
</Target>
</Project>
如果您有任何疑問,請在這里評論。我會盡力幫助您解答。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.