Cannot find Web.config when NuGet pack converts Web.Config to Web.config.transform

After a major upgrade and refactor of my VS solution, I get the following error when trying to deploy using Octopus Deploy.

A web.config file was not found, so no IIS configuration will be performed.

When I inspect the contents of the package, I find that it no longer contains a Web.config, but instead a Web.config.transform.

Looking at the log when my project is packaged using NuGet pack, I see

Add file 'C:\BuildAgent\work\eaaae51822d2b3fb\FieldViewSync.WebServices\Web.config' to package as 'content\Web.config'
...
Added file 'content\Web.config.transform'.

When I compare the source Web.config and the packaged Web.config.transform, I see that as well as renaming the file, it has injected the following XML

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add name="p1s" path="*.p1s" verb="*" type="MCS.Priority1.Sync.WebServices.TransferHandler" resourceType="Unspecified" preCondition="integratedMode" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>
</configuration>

I have tried adding

But I still get the same error.

I also noticed that on my staging server (running pre-vs2013 build), IIS mounts my site in install-folder\content, but now it seems to mount it in the root of the install folder. Using seems to work around this, but I get other runtime issues.

Any help will be appreciated.

Andy

Wondering whether I should switch on the “IIS web site and application pool” and configure Site\Relative home directory to mount at /content folder

“IIS web site and application pool” was not an option - I would like to continue using an IIS virtual directory for now.

Hi Andy,

Thanks for getting in touch! Sorry about the delay in getting back to you. Can you provide us with your NuSpec and a full build log.

This should help us get to the bottom of the issue.
Vanessa

Thanks for getting back.
In the end, I worked around the issue (http://stackoverflow.com/a/29701762/270155)
Unfortunately my environment has moved on, so it would be difficult to reproduce.
Andy

Hi Andy,

Yeah no problem, as long as you are up and running no need to grab any extra information.

Vanessa