Azure / autorest.csharp

Extension for AutoRest (https://github.com/Azure/autorest) that generates C# code
MIT License
142 stars 166 forks source link

[DPG] Cannot pass multiple options into the build parameter `typespecAdditionalOptions` #3362

Closed ArcturusZhang closed 4 months ago

ArcturusZhang commented 1 year ago

Describe the issue or request

It is documented here that we could just this syntax:

option1=value1;option2=value2

to pass multiple typespec emitter options, but actually it does not work. The content after the semicolon will be ignored. If we use this command in azure-sdk-for-net repo

dotnet build /t:GenerateCode  /p:typespecAdditionalOptions="debug=true;csharpGeneratorPath=/path/to/autorest.csharp/artifacts/bin/AutoRest.CSharp/Debug/net6.0/AutoRest.CSharp.dll"

the script can only get the value before semicolon and others are just ignored.

ArcturusZhang commented 1 year ago

it turns out that ; does not work, such as:

dotnet build /t:GenerateCode /p:typespecAdditionalOptions="csharpGeneratorPath=./autorest.csharp/artifacts/bin/AutoRest.CSharp/Debug/net6.0/AutoRest.CSharp.dll;debug=true"

will not work. In the command executed, the script will only get the first part of the option csharpGeneratorPath, and debug=true is just thrown away. However, it works as a charm if we escape the symbol ; like this:

dotnet build /t:GenerateCode /p:typespecAdditionalOptions="csharpGeneratorPath=./autorest.csharp/artifacts/bin/AutoRest.CSharp/Debug/net6.0/AutoRest.CSharp.dll%3Bdebug=true"

In this way, the script will add both the options to the command.

ArcturusZhang commented 1 year ago

after some experiments, dotnet build command is the one who is responsible to the issue that the script could only receive the part before semicolon.

chunyu3 commented 4 months ago

We will not use the Typespec-Project-Generate.ps1 to generate code. close this issue.