-
Notifications
You must be signed in to change notification settings - Fork 6
Building Testing and Debugging
This page contains instructions for building Roslyn on Windows. For special instructions on building Roslyn on Linux see here.
- Visual Studio 2015 with the Visual Studio Extensibility and Windows 10 tools optional components installed
- To prevent unnecessary project.json changes, turn off NuGet package restore within Visual Studio
- Uncheck Tools -> Options -> NuGet Package Manager -> General -> Automatically check for missing packages during build in Visual Studio
- Open Developer Command Prompt for VS2015
- Clone https://github.com/dotnet/roslyn
- Run:
nuget.exe restore Roslyn.sln
- Open Roslyn.sln
To run the unit tests:
msbuild /v:m /m BuildAndTest.proj /p:PublicBuild=true /p:DeployExtension=false
This command will build and run all of the code / tests which are supported on the current public build of Visual Studio 2015.
To debug suites use the xunit.console.x86.exe runner command which is included in the xunit.runners NuGet package. Make sure to use a 2.0 version of the runner.
xunit.console.x86.exe [UnitTestDll] -noshadow
Please see Contributing Code for details on contributing changes back to the code.
Roslyn binaries are configured to be delay signed using the Microsoft strong name key. We are using a new technique to allow these assemblies to be loaded - currently 'fakesign' - these assemblies do not need to have strong name signing disabled to be loaded. However, they cannot be installed in the GAC neither can they be loaded from a partially trusted AppDomain.
In order to test changes in Visual Studio without affecting the normal development environment, Visual Studio can be run using an isolated registry hive and AppData directories via the /rootSuffix Roslyn command line option. When Roslyn is built it creates and populates this hive with the necessary packages.
"%devenvdir%"\devenv.exe /rootSuffix Roslyn
From the command prompt, change directory to <clone dir>
and run Src\.nuget\nuget restore Src\Roslyn.sln
This ensures that all of the references and tools needed to build Roslyn are present on the computer. Because we use toolset packages, it's important to do this before opening the solution.
When you build using VS 2015 the updates will be deployed to the Roslyn Hive and ready for debugging. Note that only the components up to the Workspaces layer will be deployed.
Debugging Visual Studio
To begin
- In Solution Explorer, right click the project "OpenSourceDebug" and choose "Set as Startup Project"
- Choose Debug\Start Debugging (F5)
At this point, you will be able to debug the code that you changed. Note that not all aspects of the compiler are executed inside the Visual Studio process, so you may not hit all breakpoints. Visual Studio will call many of the APIs in your built binaries to power its own features, but if you invoke a build inside your target Visual Studio, that will launch a new instance of csc.exe and vbc.exe. This technique does not execute vbcscompiler.exe. csc.exe and vbc.exe are a separate process and are not retained in memory after compilation is complete.
If you have installed and built Roslyn with a previous build of Visual Studio, you may get an InvalidCast out of VS MEF, this is because the VS MEFCache is out of date, I cured this by re-creating the roslyn hive by running this command at a Dos Prompt:
"%VSSDK140Install%\VisualStudioIntegration\Tools\Bin\CreateExpInstance.exe" /Create /VSInstance=14.0 /RootSuffix=Roslyn
At the command line type:
set RoslynHive=VisualStudio\14.0Roslyn
MSBuild someproj.vbproj
Removing the code To remove the code
- Start Task Manager and end all "VBCSCompiler.exe" processes
- Delete the directory containing your local git clone
Uninstalling the End User Preview (optional)
You are welcome to continue to use the End User Preview to provide feedback on the potential new language and IDE features it contains, but if you want to uninstall it, you can do so by following these steps:
- Start Task Manager and end all “VBCSCompiler.exe” processes
- Start Visual Studio
- Go to Tools\Extensions and Updates
- Select "Roslyn Preview" and click “Uninstall”
#Contributors Building, Testing, and Debugging
#Tool Authors Getting Started
#Status Language feature status
Edit-and-Continue Supported Edits
#Interactive Docs Interactive Window Documentation