1

我正在使用 vnext build,我不想创建包的 zip 文件夹。我当前的 MSBuild 参数会创建 zip 文件夹。

/p:CreatePackageOnPublish=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageLocation="$(build.stagingDirectory)"

--abc.zip --Packages.zip .... --test.zip

我正在使用以下 MS 构建参数,但是当我运行构建时,它确实为同一解决方案下的各个项目创建了单独的文件夹。有什么解决办法吗???

p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl=$(build.artifactstagingdirectory)

4

2 回答 2

1

在发布配置文件中使用相对路径 (....\a\WebMVC)(这些项目的配置文件文件名相同,例如 MyPublish.pubxml),例如:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <PrecompileBeforePublish>True</PrecompileBeforePublish>
    <EnableUpdateable>True</EnableUpdateable>
    <DebugSymbols>False</DebugSymbols>
    <WDPMergeOption>DonotMerge</WDPMergeOption>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>..\..\a\WebMVC</publishUrl>
    <DeleteExistingFiles>False</DeleteExistingFiles>
  </PropertyGroup>
</Project>

然后论据:/p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:PublishProfile="MyPublish"

您还可以为每个项目添加多个 Visual Studio 构建任务,只需为每个项目添加额外的参数/t:[projectname]

于 2017-07-31T03:28:17.377 回答
1

在不同目录中发布多个项目。您可以通过为每个项目设置发布配置文件来实现此目的。为具有相同名称的每个项目添加发布配置文件。

然后您可以使用文件系统发布方法将输出发布到每个项目的不同目录。

在 Ms-build 参数中调用发布配置文件。

/p:DeployOnBuild=true;PublishProfile=yourProfileName

这不会打包文件并创建.zip文件夹。有关创建发布配置文件等更多详细信息,请参阅本教程(即使它与旧 XAML 构建相关)--如何使用 TFS 构建在一个解决方案中发布多个 Web 项目

于 2017-07-28T10:10:48.843 回答