Use publish profile to pre-compile ASP.NET so that OctoPack packs a pre-compiled website

I am loving Octopus Deploy for releasing ASP.NET sites and services, it is superior to other CI tools I have used in every discernible way. However, with Microsoft Release Management (and TFS) I was able to invoke an ASP.NET publish profile from MSBuild (arguments: /p:DeployOnBuild=true /p:PublishProfile=“CI.pubxml” ) and then “publish” while building. This would pre-compile the software in place within the TFS drops directory.

CI.pubxml contents:

<?xml version="1.0" encoding="utf-8"?> FileSystem Release Any CPU True True False False DonotMerge False $(TF_BUILD_DROPLOCATION)\_PublishedWebsites\WCF.HttpHost True $(windir)\Microsoft.NET\Framework\v4.0.30319

However, with Octopus Deploy I believe OctoPack is invoked before “build pre-compilation” takes place so the published_sites directory ends up with nothing but a “BuildInfo.config” in the NuGet package.

My company is very strict about deploying pre-compiled sites. I suppose I could pre-compile as part of the deployment process, but I do not like that and it violates company policy. I would also appreciate not having to stick a bunch of settings in any project file to make it happen when I already have dozens of publish profiles configured correctly.

How would you recommend I pre-compile now that I can’t do it at build?

Well, I just considered that I do not think Octopus Deploy cares about the TFS drops folder. Maybe if I could pre-compile right to the build directory instead?

Hi Austin,

This post does a good job of detailing the two main options.

As Option B shows, you can still pre-compile as part of your build process. You just have to jump through a few hoops.

I hope this helps,