C# 将多个web项目输出到同一目录的MSBuild解决方案

C# 将多个web项目输出到同一目录的MSBuild解决方案,c#,asp.net,asp.net-mvc-3,msbuild,C#,Asp.net,Asp.net Mvc 3,Msbuild,我想构建许多web项目,并将它们输出到一个目录,如./output/Project1./output/Project2等。这些文件夹中的每一个基本上都包含输出到_PublishedWebsites的内容。我试过这个: msbuild support.sln /p:configuration=Release;DeployOnBuild=true;DeployTarget=Package;_PackageTempDir=c:/ws/code/supportsite/output/ /t:packag

我想构建许多web项目,并将它们输出到一个目录,如./output/Project1./output/Project2等。这些文件夹中的每一个基本上都包含输出到_PublishedWebsites的内容。我试过这个:

msbuild support.sln /p:configuration=Release;DeployOnBuild=true;DeployTarget=Package;_PackageTempDir=c:/ws/code/supportsite/output/ /t:package

但它似乎会用构建的每个项目覆盖输出目录的内容

为什么不制作目标文件

XCopyWebDeploy.targets

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>

        <XCopyDeployWebPackage Condition="  '$(XCopyDeployWebPackage)' == '' ">false</XCopyDeployWebPackage>
    </PropertyGroup>

    <ItemGroup>
        <ProjectFileItem Include="$(ProjectPath)"/>
    </ItemGroup>

    <PropertyGroup>
        <!-- Make the build depend on web deploy packages -->
        <BuildDependsOn Condition="$(XCopyDeployWebPackage) == 'true'">
            $(BuildDependsOn);
            Package;
            XCopyDeployWebPackage;
        </BuildDependsOn>
    </PropertyGroup>

    <Target Name="XCopyDeployWebPackage">
        <CreateItem Include="$(ProjectDir)obj\$(Configuration)\Package\PackageTmp\**\*.*">
            <Output ItemName="XCopyWebDeployPackageOutputFiles" TaskParameter="Include"/>
        </CreateItem>
        <CreateProperty Value="c:\ws\code\supportsite\output\%(ProjectFileItem.Filename)">
            <Output PropertyName="XCopyWebDeployOutput" TaskParameter="Value"/>
        </CreateProperty>
        <Copy 
            SourceFiles="@(XCopyWebDeployPackageOutputFiles)"
            DestinationFiles="@(XCopyWebDeployPackageOutputFiles->'$(XCopyWebDeployOutput)\%(RecursiveDir)%(Filename)%(Extension)')"/>
    </Target>
</Project>

$(MSBuildProjectDirectory)\\
假的
$(BuildDependsOn);
包裹
XCopyDeployWebPackage;
并导入到web项目文件中


调试
任意CPU
2
{BF6B6392-1398-42D3-AA90-ED87D02D351A}
{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
图书馆
性质
MVC应用1
MVC应用1
v4.5
假的
真的
..\
真的
真的

我更喜欢使用现有命令执行此操作。我不想写自定义的构建任务。我也对它感兴趣,你找到解决方案了吗?
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
    <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
        <ProductVersion>
        </ProductVersion>
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectGuid>{BF6B6392-1398-42D3-AA90-ED87D02D351A}</ProjectGuid>
        <ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
        <OutputType>Library</OutputType>
        <AppDesignerFolder>Properties</AppDesignerFolder>
        <RootNamespace>MvcApplication1</RootNamespace>
        <AssemblyName>MvcApplication1</AssemblyName>
        <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
        <MvcBuildViews>false</MvcBuildViews>
        <UseIISExpress>true</UseIISExpress>
        <IISExpressSSLPort />
        <IISExpressAnonymousAuthentication />
        <IISExpressWindowsAuthentication />
        <IISExpressUseClassicPipelineMode />
        <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
        <RestorePackages>true</RestorePackages>
        <!--!!!-->
        <XCopyDeployWebPackage>true</XCopyDeployWebPackage>
        <!--!!!-->
    </PropertyGroup>

    <!-- Some lines omitted -->

    <Import Project="$(SolutionDir)\.nuget\nuget.targets" />

    <!--!!!-->
    <Import Project="$(SolutionDir)\XCopyWebDeploy.targets" />
    <!--!!!-->

    <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
    <Target Name="BeforeBuild">
    </Target>
    <Target Name="AfterBuild">
    </Target> -->
</Project>