random thoughts and discussions on the things that interest me

Running Roslyn on a Build Server

If like the majority of people you shy away from installing a full blown copy of Visual Studio on your build server (for whatever reason) but you’d like to use it to compile using Roslyn then this can be achieved by following the advice given on this StackOverflow post. The steps I took were as follows:

1. Install the Roslyn End User Preview on the machine you use for developing.

2. Locate the following folder %userprofile%\AppData\Local\Microsoft\MSBuild\12.0

3. Copy the file Microsoft.CSharp.Roslyn.targets from \Microsoft.CSharp.targets\ImportAfter into C:\Program Files (x86)\MSBuild\12.0 on the build server into similarly named folders

4. Open up the file Microsoft.CSharp.Roslyn.targets and locate the element named RoslynToolPath and make a note of it’s value. This is the location of the compiler on your development machine.

5. Copy the contents of the folder containing the compiler onto the build server and place it them in a folder that is accessible from the security context under which the build process will be running.

5. Replace the RoslynToolPath in the Microsoft.CSharp.Roslyn.targets file on the build server with the path into which you have just copied the compiler.

6. Repeat for Microsoft.VisualBasic.Roslyn.targets if you want to build VB.NET using Roslyn too.

No Responses to “Running Roslyn on a Build Server”

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.