在MSBuild的已建成我的解决方案(用一个asp.net网站),以及webdeployment项目已建成并投入网站目录_PublishedWebsites:

C:\ mybuilds \ buildName \ Daily_20090519.3 \ Release_PublishedWebsites \ MyWebsite

我怎么这个复制到固定的目录,IIS指向的测试网站?

我发现的代码段的负荷,但我似乎无法找到一个会考虑到一个事实,即该目录名称更改。

有帮助吗?

解决方案

这是很容易的。您可以编辑的项目,然后插入类似如下的东西。

<PropertyGroup>
  <OutputDest>$(MSBuildProjectDirectory)\..\OutputCopy\</OutputDest>
</PropertyGroup>
<Target Name="AfterBuild">
  <!-- Create an item with all the output files -->
  <ItemGroup>
    <_OutputFiles Include="$(OutputPath)**\*" Exclude="$(OutputPath)obj\**\*" />
  </ItemGroup>
  <!-- You probably don't want to include the files in the obj folder so exclude them. -->

  <Message Text="OutputDest : $(OutputDest)" />
  <Copy SourceFiles="@(_OutputFiles)"
        DestinationFiles="@(_OutputFiles->'$(OutputDest)%(RecursiveDir)%(Filename)%(Extension)')"/>
</Target>

这是你在寻找什么?

我的书:里面的微软构建引擎:使用的MSBuild和团队基础生成

其他提示

我使用不同的技术。

<PropertyGroup>
    <BinariesRoot>c:\BinariesForIis\</BinariesRoot>
</PropertyGroup>

c:\BinariesForIis\将用于直接输出编译的二进制文件(复印前...\Daily_20090519.3\Release_ ...)。

scroll top