代码之家  ›  专栏  ›  技术社区  ›  simon831

MSBuild和_PublishedWebsites

  •  2
  • simon831  · 技术社区  · 17 年前

    MSbuild生成我的解决方案(使用asp.net网站)并且webdeployment项目生成网站并将其放入目录\u PublishedWebsites后:

    c:\mybuilds\buildName\Daily\u 20090519.3\Release\u PublishedWebsites\MyWebsite。

    我已经找到了大量的代码片段,但是我似乎找不到一个能够考虑到这个目录名更改这一事实的代码片段。

    2 回复  |  直到 17 年前
        1
  •  1
  •   sth    16 年前

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

    这个 c:\BinariesForIis\ ...\Daily_20090519.3\Release_ ...).

        2
  •  1
  •   aloisdg    7 年前

    这很容易。您可以编辑项目并插入类似于以下内容的内容。

    <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>
    

    这就是你要找的吗?

    我的书: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build