VSTS msbuild: How to use parameters instead of profile? Error: Could not find __.dll

VSTS msbuild: How to use parameters instead of profile? Error: Could not find __.dll

我有一个简单的 "Hello World" mvc web 应用程序,我试图在 VSTS 中构建它。我的步骤是:

  1. 获取资源
  2. 运行 单个项目上的 msbuild
  3. 发布工件(发布目录)

每当我使用 msbuild 的配置文件时一切正常,但我只想传递参数命令。当我这样做时,出现以下错误:

Error : Copying file bin\WebApp01.dll to obj\Release\Package\PackageTmp\bin\WebApp01.dll failed. Could not find file 'bin\WebApp01.dll'.

我在使用 msbuild 参数时犯了什么错误?如何正确复制简单的文件系统配置文件?

参数(错误):

/p:DeployOnBuild=true /p:Configuration="Release" /p:Platform="Any CPU" /t:WebPublish /p:WebPublishMethod=FileSystem /p:publishUrl=PublishToOctopus

简介(作品):

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>PublishToOctopus</publishUrl>
    <DeleteExistingFiles>False</DeleteExistingFiles>
  </PropertyGroup>
</Project>

使用/p:DeployOnBuild=true时,可以使用正常的Build目标。您直接调用了 WebPublish (/t:WebPublish),它期望构建已经发生,但由于它没有发生,因此文件从预期位置丢失。