Execute build script after build but before nuget packaging

ctstone's Avatar


19 Aug, 2014 04:10 PM

I have a post-build script that strongname-signs my compiled assembly. However, I can see that this script is being executed after the nuget artifact is packaged which means the dll in the nuget package stays unsigned. Is there any way to make sure my post-build script executes immediately after the build?

Or do I need to disable 'Package NuGet projects' and incorporate that action directly into my post-build script? I suppose unpacking + sign + repacking the the nuget package would also work, but is not ideal.

  1. Support Staff 1 Posted by Feodor Fitsner on 19 Aug, 2014 04:52 PM

    Feodor Fitsner's Avatar

    I would incorporate signing logic into post build target inside csproj file. Otherwise, yes, you can disable auto-packaging and call nuget pack command from your after build script.

    - Feodor

  2. 2 Posted by ctstone on 19 Aug, 2014 08:40 PM

    ctstone's Avatar


    Here's what I did in case anyone is curious:

    Environment Variables
    StrongNameKey= secure string containing base64 encoded key bytes
    StrongNameKeyPath= "c:\keys\mykey.snk"

    Install Script

    mkdir ([io.path]::GetDirectoryName($env:StrongNameKeyPath)) | out-null
    [IO.File]::WriteAllBytes($env:StrongNameKeyPath, [Convert]::FromBase64String($env:StrongNameKey))


      <PropertyGroup Condition=" '$(APPVEYOR)' == 'True' ">
      <PropertyGroup Condition=" '$(APPVEYOR)' == '' ">

    And nothing at all in the post-build script.

  3. Support Staff 3 Posted by Feodor Fitsner on 19 Aug, 2014 08:42 PM

    Feodor Fitsner's Avatar

    Awesome, thanks for sharing the solution!

  4. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:47 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac