【问题标题】:MS Build Parameters ( Publish to File System how to put multiple projects in different directories)MS 构建参数(发布到文件系统如何将多个项目放在不同的目录中)
【发布时间】:2018-01-03 15:23:48
【问题描述】:

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

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

--abc.zip --包.zip …… --test.zip

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

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

【问题讨论】:

  • 有两个不同的 MSbuild 参数,你实际使用的是哪一个?

标签: msbuild tfs-2015 vnext


【解决方案1】:

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

然后您可以使用File system Publish Method 将输出发布到每个项目的不同目录。

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

/p:DeployOnBuild=true;PublishProfile=yourProfileName

这不会打包文件并创建.zip 文件夹。有关创建发布配置文件等更多详细信息,请参阅本教程(即使它与旧 XAML 构建相关)--How to Publish multiple Web Projects in one Solution with TFS Build

【讨论】:

    【解决方案2】:

    在发布配置文件中使用相对路径 (....\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]

    【讨论】:

      猜你喜欢
      • 2016-06-25
      • 1970-01-01
      • 1970-01-01
      • 2018-07-28
      • 1970-01-01
      • 2013-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多