Originally posted on: http://geekswithblogs.net/alexhildyard/archive/2017/11/10/octopus-deploy--format-exception-unpacking-windows-nuget-package-onto.aspx
There appears to be an issue with OD's "Deploy NuGet package" task (tested in Octopus Deploy 3.1.5). We encountered the problem while unpacking a .NET Core 2.0 application on a Windows tentacle and copying the resultant assets to an Ubuntu box. We noticed that if the assets were extracted using OD's in-built "Deploy package" task, the application would fail to launch on the Linux box with an "incorrect format" exception. If we unpacked the NuGet package some other way however (eg. manually extracted it), the application would run without error.
As a workaround, there are quite a few options. We have tried both of the following successfully:
1. Share the Octopus Packages folder, and then replace the "Deploy NuGet Package" step with a call to the "[System.IO.Compression.ZipFile]::ExtractToDirectory()" method, using the Octopus.Project.Name and Octopus.Release.Number properties to identify the package to extract and the Octopus.Tentacle.Agent.ApplicationDirectoryPath and Octopus.Environment.Name properties to identify the desired extraction path.
2. Install mono on the Linux box in question and unpack the package there using the "Deploy NuGet Package."
I have raised a Support ticket with Octopus Deploy: