AutoRest is developed primarily in C# but generates code for multiple languages. To build and test AutoRest requires a few things be installed locally.
Expected time around 100 minutes to install.
Enable Developer Mode in win10
In Cortana, search for
click “Developer Mode”, answer “yes”
scroll down, and click apply, apply, apply
shutdown -r -t 0)
After Reboot, login then:
cmd prompt (admin) – (ELEVATED!)
start Powershell and run this command:
See the actual script at: https://github.com/Azure/autorest/blob/master/Tools/setup-developerworkstation.ps1
# download the install script and run it. iwr https://raw.githubusercontent.com/Azure/autorest/master/Tools/setup-developerworkstation.ps1 -OutFile c:\install-software.ps1 ; c:\install-software.ps1
After this script finishes, you’re done! No need to go through the instructions for manual setup.
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
To compile the code in Visual Studio IDE,
Install .Net CoreCLR RTM using these steps.
To make sure you’ve set up all the prerequisites correctly, run
.\Tools\Verify-Settings.ps1 before you attempt to build.
AutoRest.sln is used to build AutoRest code generator.
We use gulp and msbuild / xbuild to handle the builds. Install for global use with
npm install gulp -g
If you would like to see what commands are available to you, run
gulp -T. That will list all of the gulp tasks you can run. By default, just running
gulp will run a build that will execute clean, build, code analysis, package and test.
[13:54:21] Using gulpfile ./autorest/gulpfile.js [13:54:21] Tasks for ./autorest/gulpfile.js [13:54:21] ├── regenerate:expected [13:54:21] ├── regenerate:delete [13:54:21] ├── regenerate:expected:csazure [13:54:21] ├── regenerate:expected:cs [13:54:21] ├── clean:build [13:54:21] ├── clean:templates [13:54:21] ├── clean:generatedTest [13:54:21] ├─┬ clean [13:54:21] │ ├── clean:build [13:54:21] │ ├── clean:templates [13:54:21] │ └── clean:generatedTest [13:54:21] ├── syncNugetProjs [13:54:21] ├── syncNuspecs [13:54:21] ├─┬ syncDotNetDependencies [13:54:21] │ ├── syncNugetProjs [13:54:21] │ └── syncNuspecs [13:54:21] ├── build [13:54:21] ├── package [13:54:21] ├── test [13:54:21] ├── analysis [13:54:21] └── default
Prior to executing
gulp to build and then test the code, make sure that the latest tools are setup for your build environment.
If you’re running Windows and get errors like this while building:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly ‘AutoRest, Version=0.17.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A) —> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
It means you need to disable strong name validation on your dev box:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\sn.exe" -Vr *
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\sn.exe" -Vr *
After building, the
AutoRest.exe executable will be output to the
/binaries/net45/ folder. You can run it with the command line options specified in the Command Line Interface documentation.
You can run (and debug) AutoRest by providing the command line parameters in the properties for the AutoRest project. To set these:
Command line argumentsfield in the
Make sure that you have run
npm install in the root folder.
AutoRest.execomplains about not having generators for each language
Make sure that you have built the entire
gulp is not recognized as an internal or external command
gulp is located at
C:\Users\[user]\AppData\Roaming\npm\gulp in Windows after you install it globally.
gulp syncDependenciesfrom the root of the cloned AutoRest repository