Roslyn compiler is being copied to the wrong folder

NyronW's Avatar


08 Aug, 2017 11:53 AM

Good day everyone,
  I am using the octo.exe cli tool as part of a build pipeline that I am implementing for a project that i am working on to learn Dev Ops. The project consists of an web app and a console application that will be deployed as a windows service using top shelf. The web project uses the roslyn compiler; When I package the web application the csc.ex and its related files are cpoied in the root of the bin directry as well as in the roslyn folder that's location in the bin directory. Using the octopack nuget package seems to put the roslyn files in thew correct location (only in the roslyn folder), however some dependencies (class libraries) are not included in the out put.

Can someone provide some guidance on how I can resole the issue (preferably using the octo.exe cli).


  1. Support Staff 1 Posted by Shannon Lewis on 09 Aug, 2017 05:47 AM

    Shannon Lewis's Avatar


    Thanks for getting in touch. I think this would be a scenario where you would have to stage the build output into a folder with the correct content and structure, and then run octo.exe against that folder.

    Could you provide any more detail in the way of a build log or sample project or anything? Octo.exe should simply be zipping the folder you point it too, so I'm just trying to work out which piece is causing the csc.exe to be copied into 2 places.


  2. 2 Posted by NyronW on 11 Aug, 2017 10:15 PM

    NyronW's Avatar

    I think you're correct, I am outputting the application to a specific folder and the csc.exe is indeed copied to both the root of the bin folder and the Roslyn folder in the bin. Not sure why that's happening.

  3. Support Staff 3 Posted by Shannon Lewis on 21 Aug, 2017 10:18 PM

    Shannon Lewis's Avatar


    Could I just check which version of the Roslyn Code Dom Provider you are using? We've had another report of an issue that relates to a bug that with the Roslyn package, see

    I'm not sure if this is related to your issue, but given it relates to that same folder not being handled correctly, it is possible.


  4. Support Staff 4 Posted by Shannon Lewis on 10 Nov, 2017 12:17 AM

    Shannon Lewis's Avatar


    Just a quick follow up on this, 1.0.8 of the Roslyn package has been released and looks to have fixed this issue.


  5. 5 Posted by ehuggins on 15 Nov, 2017 10:26 PM

    ehuggins's Avatar

    I am using OctoPack as part of an MSBUILD Solution Build with version 3.6.3 of Octopack loaded via Nuget.

    The solution build consistently creates an Octopus Package on the local machine via devenv.exe and VSTS Build as follows:

    The VSTS Solution build uses the MSBUILD switches: /P:OctoPackPackageVersion="$(Build.BuildNumber)" /p:RunOctopack=true

    After build completion the Source Directory contains

    OctoPack is creating:

    The build log (fragment attached) clearly shows OctoPack is inserting as bin/bin/Roslyn

    This does not appear to be a msbuild issue.

    Is there a different version of OctoPack I can use?
    Note: I will be switching to manually copying Roslyn to the properly location and using a VSTS OctoPack command to build the app package for now.I was hoping it would be a bit simpler just to do an inline Solution build and pickup the various Octopus Deployment packages from the build.

  6. Support Staff 6 Posted by Shannon Lewis on 17 Nov, 2017 01:55 AM

    Shannon Lewis's Avatar


    I've rerun my testing on 1.0.8 of Microsoft.CodeDom.Providers.DotNetCompilerPlatform and cannot fault it. I'm building a web application using a very vanilla configuration.

    Can I confirm that you're using that version of Microsoft.CodeDom.Providers.DotNetCompilerPlatform and what type of project is it that you're building? OctoPack gets the list of files from a call in to MSBuild, so suspect it could be one of the project settings causing it. Have you overridden the Output directory or anything like that?


  7. 7 Posted by ehuggins on 17 Nov, 2017 06:11 PM

    ehuggins's Avatar

    The solution contains a VS2017 MVC project and two RedGate ReadyRoll projects.
    The CodeDom Nuget version is 1.8.0

    I am performing a solution build in VSTS to ensure a single version number is generated and applied to each of three separate Octopus Packages; an MVC package; an application database package; and an Authentication Database package. VSTS Release Management then uploads the packages to Octopus deploy and sends Octopus a Create Release command to deploy all three packages to UAT. Following a targeted approval step - VSTS Release then sends a Promote command to deploy the packages to Production.

    I can confirm the issue with the Roslyn folder location is with the Microsoft CodeDom Nuget package version 1.8.0.

    I found a post on Stakoverflow indicating the issue is with the "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" file.
    Specifically that adding the following code to the props file just above the line containing:

    <Target Name="CopyRoslynCompilerFilesToOutputDirectory" AfterTargets="CopyFilesToOutputDirectory">

    to the props file would correct the issue (additional code follows):
    <Target Name="IncludeRoslynCompilerFilesToItemGroup" AfterTargets="ResolveAssemblyReferences" >
      <None Include="@(RoslyCompilerFiles)" Condition="">

    I tested the fix and confirmed this corrected the bin/bin/roslyn issue seen when packaging the solution in OctoPack.

    I briefly toyed with creating a locally patched nuget instance, but decided instead to patch the VSTS build using Copy Files and the Manual Octopus Pack step once the file structure was properly prepared to prepare the MVC project package - while continuing to use the solution generated packages for the ReadyRoll projects.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac