Reputation: 5848
I've added Microsoft.CodeDom.Providers.DotNetCompilerPlatform to my website in my Visual Studio 2015 solution to provide some C#6 features using Nuget. Everything runs and builds fine locally.
I've checked the code into TFS and created a build task for it. However I get the following error when this is built via TFS:
ShowcasePortal\web.config(20,0): Error ASPCONFIG: The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located.
When executing the line:
Build:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /localhost_15584 -p ShowcasePortal\ -u -f PrecompiledWeb\localhost_15584\
This is all hosted on visual studio online.
Is there anyway to get this build?
UPDATE:
I've noticed by default that the Bin folder is not checked in automatically. This has the Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll locally as well as a roslyn folder. I've added this to source control (not too sure if Roslyn folder needs to be added. Once added this works.
packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.2" targetFramework="net461" />
<package id="Microsoft.Net.Compilers" version="1.3.2" targetFramework="net461" developmentDependency="true" />
</packages>
BUILD DEFINITON
The build definition looks like as follows:
This is just a bog standard build for a solution where I have not done anything special to make this build.
UPDATE 8th Dec
I added the bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll.refresh file to version control and kicked off a build which gave me the following error:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /localhost_15584 -p ShowcasePortal\ -u -f PrecompiledWeb\localhost_15584\
ASPNETCOMPILER(0,0): Error ASPRUNTIME: Could not find a part of the path 'C:\a\1\s\ShowcasePortal\bin\roslyn\csc.exe'.
Now the bin\Roslyn folder does exist on my machine locally. This is not checked in.
There is another package on nuget named Microsoft.CodeDom.Providers.DotNetCompilerPlatform.BinFix. I installed this and tried the cloud build. This did not work - it came up with the same error (could not find csc).
WORKING SOLUTION
When the package Microsoft.CodeDom.Providers.DotNetCompilerPlatform is added, it brings along the dependant Microsoft.Net.Compilers package. This adds the file Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll to the website Bin folder. There is also a Bin\Roslyn folder which is not added to the solution. This contains the various compiler binaries. Once the Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll is checked into version control aswell as ALL of the Bin\Roslyn files, the cloud server build will compile successfully.
Upvotes: 4
Views: 1748
Reputation: 51103
The best solution for you just as MrHinsh mentioned you should use NuGet package to manage the dlls.
And in the build definition using Nuget Install task before your build task.
Related Nuget Package
Upvotes: 1