Search code examples
c#restautorest

How to downgrade Autorest extensions - specifically C# extension?


I am using Autorest to generate C# code from an OpenAPI YAML file. I tried to upgrade the Autorest C# extension to the newest version (3.0.0 beta), but I decided I don't want to use this version. Now I cannot figure out how to downgrade.

Ideally I want to run the same versions of Autorest and its extensions as my colleague here:

  • autorest 3.1.3
  • @autorest/core 3.0.6320
  • @microsoft.azure/autorest.core 2.0.4417
  • @microsoft.azure/autorest.csharp 2.3.91
  • @microsoft.azure/autorest.modeller 2.3.55

But I'll be content just to downgrade the C# extension to 2.3.91, or just any 2.x version.

I cannot find any command to do this. Can anyone help?

EDIT: I am running Autorest from a command line. I have Autorest installed as a stand-alone tool on my machine. It is not installed as a NuGet Package or anything like that. The comments seems to suggest that it is possible to control the Autorest version via configuration when running it. I would also appreciate a reference to documentation explaining how to do this.


Solution

  • I solved it by adding the following to my command line arguments:

    --version=3.0.6320 [email protected]/[email protected]
    

    Previously my command line had no version specified, so it would just use the newest version installed on the local machine. That, of course, was a recipe for machine-dependent disaster.

    Thanks to the Autorest GitHub for the answer: https://github.com/Azure/autorest/issues/4342