6

When I update my dotNet MVC project to use v1.0.6 of Microsoft.CodeDom.Providers.DotNetCompilerPlatform I get deployment issues in that the roslyn directory is no longer placed under the bin directory of the deployment.

I have v2.3.1 of Microsoft.Net.Compilers in my project and nothing else is changed in the project other than updating Microsoft.CodeDom.Providers.DotNetCompilerPlatform via the Manage NuGet Packages feature of VS2015.

If I revert to v1.0.5 of Microsoft.CodeDom.Providers.DotNetCompilerPlatform all works fine.

It appears as if this updated version of Microsoft.CodeDom.Providers.DotNetCompilerPlatform is breaking / removing Microsoft.Net.Compilers references from the project.

I tried uninstalling and then re-installing Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers from my project but that doesn't solver the issue.

I tried the suggestions in the following StackOverflow article without success.

Could not find a part of the path ... bin\roslyn\csc.exe

I also tried to manual copy the roslyn directory to the output directory, but the directory is removed on each build of the project.

I would appreciate if anyone can help shed some light on how to resolve the problem.

Les

4 Answers4

7

I had the same problem, it looks like a change in the Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props file under packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.6\build\net45

I added back in a target from the 1.0.5 version by adding back in

<Target Name="IncludeRoslynCompilerFilesToItemGroup" AfterTargets="ResolveAssemblyReferences" >
<ItemGroup>
  <None Include="@(RoslyCompilerFiles)" Condition="">
    <Link>%(RoslyCompilerFiles.Link)</Link>
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
</ItemGroup>

before

<Target Name="CopyRoslynCompilerFilesToOutputDirectory" ... />

and publishing is working again.

I think it is being tracked here link

Mark Burton
  • 151
  • 1
  • 6
3

1.0.7 was released. Please give it a try. If you see any issue, go to roslyncodedomprovider github repo and file an issue there.

mattfei
  • 498
  • 3
  • 5
  • v1.0.7 does indeed solve the problem. BUT! I had to completely uninstall 1.0.6 and then reinstall 1.0.7. Otherwise, the problem persisted (for the 12 hours it took me to figure this out -- grrrr!). – Sandy Gettings Aug 28 '17 at 15:18
0

as i see on my project, removing two lines from the csproj file - solves the problem. the two lines placed on the end of the csproj XML file, under the tag

<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

inside the tag

<PropertyGroup>

The two lines are are:

<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.2.3.2\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.2.3.2\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.7\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.7\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />

by removing them - the publishing is back to work perfectly.

Developer
  • 788
  • 6
  • 10
0

There was a typo in Github's Issue missing n (RoslyCompilerFiles) instead of RoslynCompilerFiles, fixed looks like this:

  <Target Name="CopyRoslynCompilerFilesToOutputDirectory" AfterTargets="CopyFilesToOutputDirectory">
    <Copy SourceFiles="@(RoslynCompilerFiles)" DestinationFolder="$(WebProjectOutputDir)\bin\roslyn" ContinueOnError="true" SkipUnchangedFiles="true" Retries="0" />
  </Target>

Btw my SampleWebApp.csproj from https://github.com/JonPSmith/SampleMvcWebApp had this instead (placed Roslyn next2):

  <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
  </Target>
Jan
  • 2,178
  • 3
  • 14
  • 26