Web.config files with environment names don't seem to deploy from the Octopack NuGet packages

Hi there,

I am not sure if I am doing something wrong, or if this is an issue (can’t see it as being one though).

I have a project setup with multiple steps. One step is to deploy an ASP.net site to IIS. This is initiated when code is pushed up to a branch, and teamcity initiates a build. I have the teamcity plugin for Octopus which works wonderfully. The Nuget package is created and published to the TC feed, at which point a secondary TC project kicks off to initiate the deployment via Octopus.

The NuGet package is picked up and deployed to the relevant environment by Octopus, however the deployed folder does not contain the Web.SeanEnvironment.config file I want. I assume this is also why the specific transforms I added to this file are of course not working for the environment either - the file is missing.

I have ensured the file is set to “content” in VS, and indeed if I look at the artifact for the Octopack generated nuget package on the TC build, I can actually see the file there - Web.SeanEnvironment.config in the nuget package.

I have also attached a screenshot showing my config for the step. But I don’t think the issue lies here as I can’t even see the web.config file specific to this environment that should be deployed in the folder. I’ve attached a screenshot showing the content of the folder after deployment runs too.

You’ll see that only the web.config, web.debug.config and web.release.config files are deployed into the directory.

Any help would be much appreciated!

Sean

Hi to anyone stumbling on this post,

The error turned out to be the wrong NuGet package was being picked up from the feed.

Vanessa

Hi,

To add to Vanessa’s update - I tracked down the issue to the wrong NuGet package being deployed due to a version number issue, and the fact that I was testing with two different branches in git hooked up to TeamCity (2 x projects in TeamCity that initiated Octopus deployments on completion).

I noticed in my RAW log file that the NuGet package being referenced for deployment was not actually the one I expected it to be from TeamCity’s OctoPack step. It was found under the .Tentacle folder on each OD Tentacle machine. I traced down that file, rather than the file I expected was being used from the TeamCity box, and opened that in NuGet package manager – surprise, no web.SeanEnvironment.Config!

That led me to investigate in a different direction, and I went to have a look at my Octopus step setting to grab the NuGet package – set to grab it from the TeamCity NuGet feed, with the latest possible version. Here is where the problem was:

I have two branches being used in GIT that build/initiate two different TeamCity projects – one for our proper environment, and one for my “SeanEnvironment” testing environment. I have been making my changes to the web transform files on my branch that corresponds to SeanEnvironment. The version of this NuGet package being generated is lower than the one being used on our proper branch/environment setup. So what was actually happening was that Octopus step was grabbing the NuGet package built on the other branch (which does not contain my web.SeanEnvironment.config transform). This was the whole problem, and fully explains why I could not see the environment specific web.config file deployed on my machines - I hadn’t made that change on the other branch, and I was getting the nuget package from that branch’s builds. I’ve since created a release manually selecting the NuGet package I wanted, and everything works as expected. Which means when I merge changes into the other branch everything will work as it should.