1

Configuring deployment process for the project and facing some issues with packaging the output of msbuild to a nuget package with OctoPack. Have decided to get a feedback about the process, may be I'm doing something wrong.

Preconditions:

  • .net 4.6 asp.net project with Angular 4 frontend and Angular-cli as a build tool
  • TFS 2013 (with XAML build) as a build machine
  • GIT as a source code
  • Octopus as a deployment framework
  • There are several environments, so have several web configs with transformations for asp.net and for angular-cli/webpack
  • several publish profiles that include (one per each environment):
    • PreBuild Event tag to run: npm run build

Project structure:

  • web_project
    • \src - typescript, html and scss files
    • \images
    • \assets - this folder is not a part of the project/GIT. It is created by angular-cli/webpack and contains compiled, minified and bundled js code and css files
    • \other files (index.html, web.config etc)

The build process:

Msbuid compiles C# code, then executes publish command: compiles JS code and copies everything into a custom output folder.

To run build and generate an application, I run the following command (locally or on TFS server):

MSBuild solution.sln /t:Build /p:DeployOnBuild=true /p:Configuration=development /p:PublishProfile="development"

The output of this command contains everything I need (including Assets folder): I can take it and copy for IIS.

Now, I want to integrate Octopack. I've installed Octopack nuget package and added additional parameter /p:RunOctoPack=true:

MSBuild solution.sln /t:Build /p:DeployOnBuild=true /p:Configuration=development /p:PublishProfile="development" /p:RunOctoPack=true

Octopack creates a nuget package, but it doesn't have Assets folder. According to documentation, Octopack takes everything from \bin folder, but the Assets folder exists in obj\Development. And this is not a part of the solution, this folder is being re-created every time I run npm build task.

Now, questions:

  1. Does the process workflow look OK?
  2. Is publishing via msbuild is the only possible option? Are there any other ways to make msbuild compile C#, run custom cmd/powershell file (to run npm build) and transform web configs?
  3. How to include other folders into Octopack (in my case: Assets with compiled JS)?

Thanks for the feedback

mlurker
  • 149
  • 2
  • 8
  • Did you ever find a solution for this? In a similar situation, but with TeamCity & Octopus. – Tom Jan 08 '18 at 11:37

1 Answers1

0

You can tell Octopack to add additional files by creating a nuspec file.

https://octopus.com/docs/packaging-applications/creating-packages/nuget-packages/using-octopack#UsingOctoPack-IncludingadditionalfilesusingaNuSpecfile(.nuspec)

In there you can add the paths of the files & directories you want included as part of the package.

So on your CI server, you'd want to do your client side bundling before the MS build process so that the files exsist.

Tom
  • 2,321
  • 2
  • 18
  • 29