How to deploy the Nuget packages to Octopus Deploy for Asp.net core applications

I created a Nugget packages for ASP.NET core applications.

It says Packages with dependencies are not currently supported, and dependencies won’t be downloaded nor deployed.

How can send this Nuget Packages to the server using Octopus Deploy

Hi,

Thanks for reaching out. Can I just check how you’re creating the NuGet package? If I recall correctly ‘dotnet pack’ won’t yield a package for an application, only for a library, but there are some switches you can use in the project file to force it to pack. I’m just wondering if that’s what you’re using?

We have been looking in to this, and do have something that will possibly help. We have recently been working on a dotnet CLI extension. It’s 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.

We tend to then use a pattern like

dotnet publish -o ..\publish
dotnet octo pack --basePath ..\publish --outFolder ..\artifacts --version 1.0.0 --id YourApplication

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.

Hope this helps, there will be a more detailed blog post coming soon about this CLI extension so keep an eye out for that. Please let me know how you go and if I can assist further please just let me know. Look forward to hearing back.

Regards
Shannon

Thanks for your post. It is a good Information .

I used IsPackable>true to create the packages in csproj and it worked. But I am unable to push the same packages as well.

I used dotnet pack and Octo push. I tried using another method using zip files instead of Nugget pack, but I am not sure how to deploy the unzipped folder in the IIS server.

More Over when we use this in what kind of steps do we use this
dotnet publish -o …\publish
dotnet octo pack --basePath …\publish --outFolder …\artifacts --version 1.0.0 --id YourApplication

Sorry I haven’t mentioed I am using Teamcity as Continous Integration tool so my question would be where would we use this dotnet publish -o …\publish
dotnet octo pack --basePath …\publish --outFolder …\artifacts --version 1.0.0 --id YourApplication

If I its the right thing to ask here

Hi Shannon. Sorry for the questions. I am trying an other way.

Publish the files of the project , zip it and send it to Octopus deploy using using teamcity and Unzip the files using unzip option on Octopus deploy.

Can I proceed with this process. because I am facing some Issues when I use DotNetCliToolReference Include=“Octopus.DotNet.Cli” Version=“4.30.10” /> locally .

C:\Program Files\dotnet\sdk\2.1.4\NuGet.targets(103,5): error : Failed to retrieve information about ‘NuGet.Common’ from remote source ‘http:/XXXXXXXX/httpAuth/app/nuge
t/v1/FeedService.svc/FindPackagesById()?id=‘NuGet.Common’’. [C:\Users\XXXX\Desktop\test-XXXX\XXXX\XXXXX.csproj]
C:\Program Files\dotnet\sdk\2.1.4\NuGet.targets(103,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\Users\m5likadi\Desktop\test-XXXX\XXXX
XXXX.csproj]

So those errors look like maybe you have a self hosted Git server, is that right? It looks like there’s an authentication issue against that server for some reason. The v1 in the feed Url makes me wonder if it’s a NuGet version issue, like it needs v3 or something like that.

Anyway, if you forget about the DotNetCliToolReference bit and just add NuGet reference to OctopusTools to your project then you should get Octo.exe in a tools folders under your solution’s root folder. Then just change dotnet octo to ..\tools\octo.exe in the commands above and you should be right (I think the “…” should be right, but just check depending on your folder setup).

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