dotnet build with multiple constants
See original GitHub issueHello,
I have a newly created f# netcoreapp2.1 console app with a vanilla fsproj file. I want to pass multiple constants to dotnet build. This works and the constants are validated when I run the program:
msbuild /p:DefineConstants="HELLO;WORLD"
… but this fails with MSB1006 errors:
dotnet build /p:DefineConstants="HELLO;WORLD"
dotnet build /p:DefineConstants=HELLO;WORLD
dotnet build /p:DefineConstants=\"Hello,World\"
dotnet build /p:DefineConstants=\"Hello;World\"
dotnet build /p:DefineConstants='Hello;World'
(...)
Is there a way to make this work with dotnet build cli? Thanks for the help.
Actual behavior
MSB1006 “property not valid…” is thrown
Environment data
- dotnet sdk 2.1.300
- win7-x64
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Passing define constants to dotnet build kills target ...
I created a small application which targets two frameworks (.net core 2.2 and .net core 3.0) and uses target framework symbols (NETCOREAPP2_2 ...
Read more >dotnet build command - .NET CLI
The dotnet build command builds the project and its dependencies into a set of binaries. The binaries include the project's code in ...
Read more >C# preprocessor directive symbols from the dotnet build ...
The "DefineConstants" property is a global property, and cannot be modified. Instead one has to employ a little indirection. In your csproj file ......
Read more >Environment Variables
Defining Multiple Variables per Item #. If you need to specify several environment variables for each build, put them all on the same...
Read more >C# 8.0 and .NET Core 3.0 – Modern Cross-Platform ...
Build applications with C#, .NET Core, Entity Framework Core, ASP.NET Core, and ML.NET using Visual Studio Code Mark J. Price. 2. Create a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I faced the same issue and the only working solution seems to be to escape the
;
with%3B
. E.g:dotnet clean; dotnet build "/p:DefineConstants=HELLO%3BWORLD"; dotnet run --no-build
@CodeDux Clever, I’m stealing this.