1

I'm trying to replace my TFS server with a Windows Container that will handle all of the builds using msbuild. The project I'm trying to compile is a C# .Net Framework WebSite that has only a solution file and no project file. The web.config has the <system.codedom> sections needed to target the Roslyn compiler to take advantage of the C#6 syntax however because I'm not using Visual Studio to compile the application the needed files in the bin/roslyn folder never get restored while doing the nuget restore command. Without those files being restored I receive the error

error ASPCONFIG: The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located.

Since the build tools are for visual studio 2017 I thought the gac might have the dlls and executables required for the c#6 syntax so I removed the <system.codedom> section and try to compile again only to receive compile errors for the $ for the interpolation syntax.

I've read several blog posts, example 1 example 2, where people have had success just installing the compiler package from nuget however I believe because my solution has no project file the hints and targets that would normally help restore the refresh files in the bin/roslyn folder is skipped.

How can I get msbuild to use the correct compiler and make the required dlls available without having to generate a project file?

Aaron
  • 511
  • 3
  • 25

0 Answers0