2

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?

6
  • 1
    you can't use ** in the path. Commented Sep 14, 2020 at 6:09
  • @ShaykiAbramczyk Yeah.. I changed that too /p:OutputPath:"\WebApplicationMain\Publish\" and got an error saying 'MSBUILD : error MSB1008: Only one project can be specified.' Commented Sep 14, 2020 at 6:18
  • 1
    try $(build.sourcesdirectory)\WebApplicationMain\Publish Commented Sep 14, 2020 at 6:23
  • @ShaykiAbramczyk I am on it :) Commented Sep 14, 2020 at 6:23
  • 1
    Oh I found the issue you use : instead of =, just switch it to /p:OutputPath="some-path" Commented Sep 14, 2020 at 8:03

2 Answers 2

4

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

/p:OutputPath="some/path"
Sign up to request clarification or add additional context in comments.

1 Comment

It worked. Thanks :) I even used the path p:OutputPath=$(build.artifactStagingDirectory)\WebMainPublish\
0

Not sure if this is the correct answer but it worked for me. I removed the variable $(build.artifactstagingdirectory) and replaced it with a different directory name. I used "stage". I suspect the build agent didn't like the value contained within that variable for that particular project.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.