AutoRest does not load the correct version of extension '@autorest/csharp'
See original GitHub issueRepro steps:
- At any time of this repo, clean all the cache, for example at that time the
Microsoft.Azure.AutoRest.CSharp
version is3.0.0-beta.20230328.2
. - Run
dotnet msbuild /t:GenerateCode
under an arbitrary project. The version autorest is loading should be3.0.0-beta.20230328.2
. - Change the
Microsoft.Azure.AutoRest.CSharp
version to3.0.0-beta.20230329.1
. - Run
dotnet msbuild /t:GenerateCode
again, you would see theMicrosoft.Azure.AutoRest.CSharp
version is still3.0.0-beta.20230328.2
instead of3.0.0-beta.20230329.1
.
info | Loading local AutoRest extension ‘@autorest/csharp’ (C:/Users/pashao.FAREAST/.nuget/packages/microsoft.azure.autorest.csharp/3.0.0-beta.20230328.2/buildMultiTargeting/…/tools/net6.0/any/)
Root cause:
You could go to {RopoRoot}\artifacts\obj\Azure.Analytics.Synapse.Monitoring
for example, there is a cache file project.nuget.cache
. Its content is
Suggestion:
I suggest we add a dotnet restore
to every autorest.md
, otherwise user might generate incorrect code from out-of-date generator.
Issue Analytics
- State:
- Created 6 months ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Failed to install Autorest extension... · Issue #2736 · Azure ...
When I try to generate csharp proxy I get the following error: Installing AutoRest extension '@microsoft.azure/autorest.csharp' (~2.1.0) ...
Read more >How to downgrade Autorest extensions - specifically C# ...
I am using Autorest to generate C# code from an OpenAPI YAML file. I tried to upgrade the Autorest C# extension to the...
Read more >AutoRest Versioning
The CLI can load any version of the AutoRest Core module by using the command line --version:[VERSION] where [VERSION] is one of: a...
Read more >AutoRest Extensions for OpenAPI 2.0
The following documents describes AutoRest specific vendor extensions for OpenAPI 2.0 schema. Code generation impact and support may vary per language. Some of ......
Read more >autorest | Yarn - Package Manager
The AutoRest tool generates client libraries for accessing RESTful web services. Input to AutoRest is an OpenAPI spec that describes the REST API....
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 would rephrase as “user might generate unexpected code from out-of-date generator.”
I agree with Michael. Solve this as low down the stack as possible by depending on the
Restore
target forGenerateCode
. You might need to find some way to force it, though. Maybe. Given a<PackageReference>
changed that may not be necessary.If you fix it in some higher-level script, if and when someone calls the
GenerateCode
target themselves or another script is written for some other purpose, the problem will be apparent again and may be hard to diagnose for people who aren’t as familiar with the system end-to-end.