Octo pack copying web.Environment.config to the bin folder, not the root folder

kurt.hardy1's Avatar


07 Mar, 2018 05:06 PM


I'm trying to get Octo to pack my project up for deployment, its all working except this one issue with environment files. I have a web.Development.config and a web.Live.config but they are being copied to the bin folder, not the root.

I have tried Build Action: Content, Copy to Output Directory: Always, with a nuspec with files (<file src="Web.*.config" target="." />, <file src="Web.*.config" target="" />) and without a nuspec file. Nothing seems to work for me.

I have:
1 ASP.NET Core project built using dotnet CLI
1 ASP.NET 4.6.2 project built using msbuild

Both being packaged and pushed using Octo.

Any idea?
Thanks in advance

  1. Support Staff 1 Posted by Shannon Lewis on 08 Mar, 2018 02:09 AM

    Shannon Lewis's Avatar

    Hi Kurtis,

    Thanks for reaching out. The answers are a bit different for Core and non-Core. I don't think you'd actually need a NuSpec file for either case.

    For the Core app, are you doing a dotnet publish with a -o to publish to a folder and then running Octo.exe against that basePath?

    For the 4.6.2 project, you have to go to the Publish settings for the project and create a folder based profile. Then run a build similar to

    msbuild webapplication\WebApplication.csproj /p:DeployOnBuild=true /p:PublishProfile=FolderProfile
    Note that if you're running msbuild at the solution level, rather than the project level as illustrated, all application projects will require a profile with the same name or the build will fail. You would then run Octo.exe with the --basePath set to the folder that profile is configured to output to.

    Hope that helps and please let me know how you go.


  2. 2 Posted by kurt.hardy1 on 08 Mar, 2018 02:16 PM

    kurt.hardy1's Avatar

    Hi Shannon

    I am doing exactly what you said above, running two scripts for Core and non Core.
    For the Core project I dont actually use transform files, it's all in Octopus variables.

    For MSBuild, its not copying the live and development web config transform. Could this be something missing in my csproj? Maybe in there I need to tell the project to copy the web.config files into the root folder?

    Thanks for your help

  3. Support Staff 3 Posted by Shannon Lewis on 08 Mar, 2018 09:14 PM

    Shannon Lewis's Avatar

    Hi Kurtis,

    Ah right. The trick with the config transforms is to make sure they are Content and that they are set to Copy if newer or something other than the Do not copy default. Without this the build/publish assumes the transforms are taken care of by it and that it doesn't need to include them.


  4. 4 Posted by kurt.hardy1 on 08 Mar, 2018 09:34 PM

    kurt.hardy1's Avatar

    I have tried this also sorry. This is why I think there is something wrong with my project file because I've never had this before. Or my publish setting but I cant see any settings for this.


  5. 5 Posted by kurt.hardy1 on 08 Mar, 2018 09:38 PM

    kurt.hardy1's Avatar

    OK, so I have just removed <DependentUpon>Web.config</DependentUpon> and run publish and this copies them to the root. That fixes my issue but any idea why? I know this maybe the wrong place to ask so thanks in advance.


  6. Support Staff 6 Posted by Shannon Lewis on 09 Mar, 2018 06:28 AM

    Shannon Lewis's Avatar

    I did some digging and it looks like when they depend on the config file the publish recognizes them as config files, and therefore applies transforms it thinks necessary and ignores the rest.
    Once you remove that dependency I think it's just seeing them as normal files and then including them as you'd expect.


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