Skip to content

Windows container .NET 8 RC: MSB3052: The parameter to the compiler is invalid, '/define:$BUILD_CONFIGURATION' #4870

Closed Answered by mthalman
jozefizso asked this question in Q&A
Discussion options

You must be logged in to vote

Since the variable is being referenced from a cmd.exe shell command, you need to use the appropriate syntax for that shell which is %VAR_NAME%, not $VAR_NAME. So the correct instruction would be the following:

RUN dotnet build "ppas.csproj" -c %BUILD_CONFIGURATION% -o /app/build

If you were to reference the variable outside the context of a shell command (like a FROM instruction, for example), you would use $BUILD_CONFIGURATION because that is being parsed by Docker, not cmd.exe.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@jozefizso
Comment options

@mthalman
Comment options

Answer selected by jozefizso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4868 on September 13, 2023 18:06.