Package results of TFS msbuild

(Using Octopus 2.6, TFS 2012, MSBuild 4.5?)

I am trying to migrate a solution from MSBuild and deploy to Octopus deploy. We have an msbuild project that uses node.js and require.js to combine & minify the ui code before deploying to the load-balanced web servers. I would like Octo-Pack to only package this final version, not the raw version thats gets compiled before the post-build event.

So currently the solution is built, which builds the website. Then the secondary publish.proj is built, which does the requirejs magic. The drop folder contains the final version. However the package in the octopus repository contains the initial version, pre-requirejs - it seems fair enough that OctoPack will kick in as soon as the website is built, but I need the 2nd version packaged, not the 1st!

Node.js is only installed on the build server, it cannot be installed on the Dev / Uat / Live servers. So I can’t do some funky powershell as part of the Octopus deployment steps as these will probably run on the web servers.

I’m pretty certain I need to get the package content right first, I’m just not sure how to. Any help would be much appreciated.

Hi Robert,

Thanks for reaching out. Octopack can only be triggered right after the build. So in your case (which is a very common scenario) you’re gonna need to add an extra step to your build process to pack the content of your app after it gets built, combine and minified.

To automate the packaging you can use Nuget.exe or Octo.exe:


Best regards,

Dalmiro

Thanks - I will give this a go this morning - I think Octo.exe should work. Does this still upload the created package to the Octopus Server, as it would when using OctoPack?

So it seems not. I am able to create the package with the correct contents and then I can create a release, but the package is not uploaded.

	<Target Name="PublishPackage">
		<GetAssemblyIdentity AssemblyFiles="$(PublishedWebsitePath)\bin\MyProject.Web.dll" >
			<Output TaskParameter="Assemblies" ItemName="WebAssemblyInfo" />
		</GetAssemblyIdentity>
		<Message Text="Octopus: Packaging website" />
		<Exec WorkingDirectory="$(PublishedWebsitePath)" Command="C:\Tools\octo.exe pack --id=MyProject.Web --version=%(WebAssemblyInfo.Version)" />
		<Message Text="Octopus: Create release" />
		<Exec WorkingDirectory="$(PublishedWebsitePath)" Command="C:\Tools\octo.exe create-release --project=&quot;My Project&quot; --server=http://server:8050/ --apiKey=API-1234 --package=MyProject.Web:%(WebAssemblyInfo.Version)" />
	</Target>

Log file attached below.

MSBuild log file attached.

Octopus release log shows this:
Operation: Acquire package MyProject.Web.3.0.5751.19589 failed with error: The package MyProject.Web version 3.0.5751.19589 could not be located in the built-in repository.
The step failed

OctoPublish.log (2 KB)

Looks like I needed to add nuget to push the package:

		<Message Text="Octopus: Push package to feed" />
		<Exec WorkingDirectory="$(PublishedWebsitePath)" Command="C:\Tools\nuget.exe push MyProject.Web.%(WebAssemblyInfo.Version).nupkg $(OctopusApiKey) -Source $(OctopusServer)nuget/packages" />
		<Message Text="Octopus: Create release" />
		<Exec WorkingDirectory="$(PublishedWebsitePath)" Command="C:\Tools\octo.exe create-release --project=&quot;My Project&quot; --server=$(OctopusServer) --apiKey=$(OctopusApiKey)" />

Let me know if there’s a simpler way to achieve this.