We have a website project which has the following nuget packages installed
Microsoft.CodeDom.Providers.DotNetCompilerPlatform - 1.0.8
Microsoft.Net.Compilers - 2.4.0
The web.config
has the following
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
Builds work fine locally. When the DotNetCompilerPlatform
is installed the install.ps1 the script creates the Roslyn folder in the bin and copies csc.exe etc to the folder.
The code is being written by a third party and committed to our VSTS repo. I want to use VSTS to build and deploy the website through our test/stage and prod environments.
The VSTS build pipeline grabs the source, then restores the packages and runs a Visual Studio Build task on the solution. It is a website project so that is no proj for the site. The build fails with the following error
ASPNETCOMPILER(0,0): Error ASPRUNTIME: Could not find a part of the path 'xxxxxxxxxx\bin\roslyn\csc.exe'.
As the build is just doing a restore of the package the Roslyn binaries are not copied to the bin.
I also try removing the packages from the project and deleting the compilers from the web.config
but then get the error.
Error CS1056: Unexpected character '$'
where I am using some of the newer language features.
I really want to automate the PreCompile and Publish as at the moment there are too many manual steps which are open to error or abuse.
One thought I had was to add a step in the build pipeline after the package restore to run the install.ps1 from the DotNetCompilerPlatform
package folder which will hopefully copy the compiler tools to the bin. i.e. mimic what is done when you install the package. But before I went down this road I wanted to see if there was a better solution.