Updating an existing project to use the Roslyn compiler

I installed VS 2015 and imported the existing solution. This solution contains the Razor helper in the App_Code folder. The error list complains:

The type or namespace name 'global_asax' does not exist in namespace 'ASP' (are you missing an assembly reference?)

After doing a little research, I discovered that this is (or was) a known issue (see this SO answer and this article ). The solution given in these articles is to manually install the Microsoft.CodeDom.Providers.DotNetCompilerPlatform

NuGet package .

So, I installed this NuGet package in my web application project and the error went away.

But now I get an error when I open the package manager console complaining that it cannot copy any file. The path (invalid) to the missing file is specified in the Microsoft.CodeDom.Providers.DotNetCompilerPlatform

NuGet package configuration information .

All of this makes me think there must be a better way!

Am I missing something? Shouldn't I automatically get the new Roslin magic through VS 2015? If not, is there a better way for me to install it in my existing project? Or am I just bumping into broken bits of infrastructure that someone needs to fix?


source to share

2 answers

Per this MSDN blog post , it is actually a solution to install the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package (which I hope and assume they have fixed since I tried this in July 2015). There is some magic sound in VS 2015 UI to install this package via the Project menu.



I created a new MVC app in VS 2015 and looked at the NuGet packages it installs. It turns out that we should apparently set


NuGet package

(not a package Microsoft.CodeDom.Providers.DotNetCompilerPlatform


EDIT: And after tinkering a little more with this solution, it doesn't seem to be any better than the (unfortunate) solution I gave in the OP. But fear not, apparently the answer is (if you are using VS 2015). I'll post this as a separate answer.



All Articles