question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet build parameters (-p) don't work when joined by semicolon (;) in dotnet 6.0.400

See original GitHub issue

Describe the bug

Using multiple MSBuild parameters joined by a semicolon in a dotnet build command don’t work anymore in dotnet 6.0.400.

To Reproduce

Executing the following command doesn’t work anymore:

dotnet build -p:propertyA=valueA;propertyB=valueB

But changing it to this does:

dotnet build -p:propertyA=valueA -p:propertyB=valueB

In my case, the command:

dotnet build -p:Version=1.1.1.1;AdditionalConstants=Beta

resulted in the following error:

Error NETSDK1018: Invalid NuGet version string: '1.1.1.1;AdditionalConstants=Beta'.

Exceptions (if any)

N/A

Further technical details

  • Using dotnet version 6.0.400 (previously worked in version 6.0.302)
  • Command being executed as part of an Azure DevOps build pipeline

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:13
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
X-Celciuscommented, Aug 22, 2022

I would like to emphasize that this causes build failures from one day to another in Azure Pipelines because of the way the DotNetCoreCLI task runs the dotnet command. In our case we run dotnet using arguments like these:

- task: DotNetCoreCLI@2
  inputs:
    command: pack
    configuration: $(buildConfiguration)
    packagesToPack: '**/*.csproj'
    buildProperties: 'InformationalVersion=Foo'

And it fails because under the hood dotnet will be run using this argument:

dotnet pack [...] /p:Configuration=Release;InformationalVersion=Foo

Which since 6.0.400 will lead to the build configuration actually being Release;InformationalVersion=Foo instead of Release.

As you can see we don’t specify semicolons or commas anywhere and we don’t have a way to specify multiple -p options on the command line. I can see that this may need to be fixed in Azure Pipelines instead but I suspect this combination to lead to build failures all over the place.

4reactions
horihelcommented, Aug 10, 2022

can confirm this too. as a workaround i found out that comma (“,”) works as a separator, but semicolon (“;”) does not.

For us this breaks the “pack” task (and a few others) in Azure Devops Pipelines, as they use semicolon as a seperator (and we can’t change that)

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet build command - .NET CLI
The dotnet build command builds a project and all of its dependencies.
Read more >
dotnet run command - .NET CLI
The dotnet run command provides a convenient option to run your application from the source code.
Read more >
NETSDK1045: The current .NET SDK does not support ...
This error occurs when the build tools can't find the version of the .NET SDK that's needed to build a project. This is...
Read more >
MSBuild reference for .NET SDK projects
This page is a work in progress and does not list all of the useful MSBuild properties for the .NET SDK. For a...
Read more >
Why don't any of these methods work for installing .Net ...
I make it run with the APT package solution, in fact there is a conflict between Ubuntu packages (Jammy feed) and Microsoft Package...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found