3

I installed VS 2015 and imported an existing solution. This solution contains a Razor helper in the App_Code folder. The Error List complains:

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

After a bit of research, I found that this is (or was) a known issue (cf. This SO answer and this article). The solution given in those articles is to manually install the Microsoft.CodeDom.Providers.DotNetCompilerPlatform NuGet package.

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

But now I get an error when I open the Package Manager Console complaining that it can't copy some file. The (incorrect) path to the missing file is given in the Microsoft.CodeDom.Providers.DotNetCompilerPlatform NuGet package configuration info.

All of this leads me to believe that there must be a better way!

Am I missing something? Shouldn't I get the new Roslyn magic automagically via VS 2015? If not, is there some better way for me to install it into my existing project? Or am I just stumbling over broken infrastructure bits that someone needs to fix?

Community
  • 1
  • 1
Bob.at.Indigo.Health
  • 11,023
  • 13
  • 64
  • 111

2 Answers2

2

I created a new MVC app in VS 2015 and stared at the NuGet packages it installs. Turns out that we apparently need to install the

Microsoft.Net.Compilers NuGet package

(rather than the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package).

EDIT: And after a bit more fiddling around with this solution, it appears to be no better than the (failed) solution I gave in the OP. But fear not, there is apparently a answer (if you are running VS 2015). I'll post that as a separate answer.

Bob.at.Indigo.Health
  • 11,023
  • 13
  • 64
  • 111
1

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

Bob.at.Indigo.Health
  • 11,023
  • 13
  • 64
  • 111