Search code examples
web-applicationsazure-devopsmsbuildazure-pipelinespublish

Azure DevOps - VSBuild for a specific project with publish not working


I have a solution that has around 63 odd projects however my primary target is around 6 projects. out of which 3 are DotNet Core APIs and 3 Web applications. I was able to publish my DotNet Core APIs using the DotNetCoreCLI@2 task. Unfortunately, when I try to publish my Web Application, I am facing the following error:

Error message

MSBUILD : error MSB1006: Property is not valid. Switch: OutputPath:**\WebApplicationMain\Publish

YAML

- task: VSBuild@1
  inputs:
    solution: '**\WebApplicationMain\MainWebApplication.csproj'
    msbuildArgs: '/t:build /p:DeployOnBuild=true /p:PublishProfile=publish.pubxml /p:OutputPath:"**\WebApplicationMain\Publish"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

here's my publish.pubxml

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <PublishProvider>FileSystem</PublishProvider>
    <LastUsedBuildConfiguration>Staging</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>Publish</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <TargetFramework>net472</TargetFramework>
  </PropertyGroup>
</Project>

What am I missing here? Any Suggestions?


Solution

  • You use : in the /p:OutputPath: instead of =, so just fix it to:

    /p:OutputPath="some/path"