1

I would like to use functionality contained in a nuget package in one of my octopus scriptcs deploy scripts. Is this possible, and if so, how?

Chazt3n
  • 1,641
  • 3
  • 17
  • 42

2 Answers2

0

If you want to invoke some code from dll contained in deployed NuGet packages, you can it in the following way: 1. Add your Octopus packages destination folder as a local NuGet repository to scriptcs. For that place in scriptcs folder nuget.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="LocalFeed"
         value="C:\Octopus\Packages\" />
  </packageSources>
</configuration>
  1. Run (from PowerShell for example) scriptsc -install <package_name>

  2. Then you can use libraries in your C# script:

    using MyLib;
    Console.WriteLine("Hello");
    
Yuriy Gavrishov
  • 4,341
  • 2
  • 17
  • 29
  • I don't need to use a nuget package I've created, but one hosted on nuget in an octopus deploy script, is this still valid? – Chazt3n Mar 09 '16 at 15:07
-1

There are a number of standard scripts you can add to your package, which will be executed during deployment:

  1. PreDeploy.<ext>
  2. Deploy.<ext>
  3. PostDeploy.<ext>
  4. DeployFailed.<ext>

These can be either PowerShell, ScriptCS, or Bash (subject to them running on the appropriate environment - Windows for PowerShell and ScriptCS or Linux for Bash).

You can read more about Custom Scripts on the Octopus Deploy website.

Fenton
  • 241,084
  • 71
  • 387
  • 401
  • Right so here's what I'm doing now, In a ps script, I install chocolatey, cinst scriptcs, scriptcs -install ; Then I run a C# script attempting to use that package, to an explosion – Chazt3n Mar 09 '16 at 15:06