我想构建许多Web项目并将它们输出到一个目录,例如./output/Project1 ./output/Project2等。这些文件夹中的每一个基本上都包含了_PublishedWebsites的输出。我试过这个:
msbuild support.sln /p:configuration=Release;DeployOnBuild=true;DeployTarget=Package;_PackageTempDir=c:/ws/code/supportsite/output/ /t:package
但它似乎用每个构建的项目覆盖输出目录的内容。
答案 0 :(得分:0)
为什么不制作目标文件。
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>
并导入web项目文件。
<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>