Deploying ASP.NET Core with External Repository

Hello,
My team has been using Octopus to deploy .NET 4 web applications and we store our artifacts as nuget packages in ProGet, an external repository. We would like to continue to use an external repository. We follow the instructions at https://octopus.com/docs/deploying-applications/deploying-asp.net-core-web-applications#DeployingASP.NETCoreWebApplications-PublishingandPackingtheWebsite to run dotnet publish and then create a zip file from the output. But, ProGet does not support .zip files and Octopus does not support deploying .zip files from external repositories. I’ve tried to use dotnet pack to create the nuget package, but it did not include everything (such as the .deps file). There is a GitHub issue about this in the cli project, and they refer us to the Octopus team for guidance. We’re also trying to do all of this on linux build machines running in docker, and so octo.exe is not available.

Is it possible to create a nuget package for an ASP.NET Core application and deploy it from an external repository?

true

try using this in in .csproj file it will create the Nuget packages. but please do let me know how to deploy iy

Hi,

Thanks for reaching out. This is by design for .NET core applications, dotnet pack is really about packaging libraries, dotnet publish is about publishing applications.

So what you are after is the dotnet publish to publish the application into the correct format in a folder, and then use Octo.exe as illustrated in that documentation to package that folder into a NuGet (this is it’s default packaging format).

We have also been working on a dotnet CLI extension recently, which may be of interest. It’s actually available on GitHub, but we haven’t completed all of our internal testing and therefore haven’t advertised it widely yet. You’re welcome to give it a try though.

All you should have to do is add this line into your csproj file

<DotNetCliToolReference Include="Octopus.DotNet.Cli" Version="4.30.10" />

and then you should have access to dotnet octo, which is essentially the core version of Octo.exe and supports all of the same commands and switches.

Using the extension, the sample from the documentation changes just slightly.

dotnet publish source/MyApp.Web --output ..\published-app --configuration Release
dotnet octo pack --basePath ..\published-app --outFolder ..\artifacts --version 1.0.0 --id MyApp.Web

to produce a NuGet package. Note that this must run from the folder containing the project, because it includes the octo extension and therefore only it can call it.

As I mentioned, all of the Octo.exe commands are supported, so you can also use push, create-release etc to get the package in to Octopus and create releases etc.

For pushing to ProGet though octo’s push command probably won’t work, as it only supports pushing to Octopus’ internal feed. You’d probably need to look at something like dotnet nuget push for that step.

Hope that helps. Please let me know how you go and if I can assist further. Look forward to hearing back.

Regards
Shannon

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.