.NET Standard 2.0 on Full Framework with PackageReference

Hi,

I am in process of migrating my web application to .NET Core 2.0 and .NET Standard 2.0. One of the steps described in the article https://github.com/dotnet/standard/issues/481 is to migrate NuGet system to PackageReference. I have done that successfully and resolved all related issues. One of those was OctoPack targets that are not available anymore because PackageReference does not use packages folder. So I removed Targets and Imports from my csproj files.

My question is will OctoPack with new PckageReference approach for NuGet packages work on Full Framework projects?

If no, what will be a workaround?

Cheers,
Andrii

Hi Andrii,

Thanks for getting in touch and sorry for the delay.

We’ve been discussing this with the team since .NET core 1 was released. Back then then the project structure and the file containing its definition suffered quite a few changes (.csproj -> .json -> back to .csproj IIRC). Now that the Microsoft waters seem to have calmed down, we can start to think on an approach that will last more than 2 months :).

Right now Octopack will only work for projects on .NET 4.X. We don’t think we’ll be extending its support to .NET core and NET Standard projects, but we are thinking about working on something similar like a dotnet octopack command.

We still haven’t come up with an approach, but I went ahead and created a Uservoice suggestion where we’ll do it in the near future. If you could drop by and add some votes + a description of an approach that would work for you, It’ll be super helpful.

For the time being, the approach we recommend is:

  1. Use dotnet publish to publish your compiled project with all the files needed to a fixed folder under your build dir.

  2. Use Octo.exe pack , Nuget.exe pack/push or something similar to create a package out of the contents of the folder in (1) and then push that package. If you need help figuring out an approach here, let me know which build server technology are you using and I’ll give you a hand.

Best regards,
Dalmiro

Hi Dalmiro,

Thank you for your response! Sorry that I was not completely clear in my question. Currently we are migrating our lib projects to .NET Standard and our web/console apps are still on Full .NET 4.6.1 Framework. To make it work we needed to change packages.config approach to PackageReference. And because of that OctoPack targets does not work anymore.

I thought maybe you already have a solution to use OctoPack with PackageReference projects on Full Framework that I have overlooked as we cannot use dotnet push there.

One approach I could use is to include OctoPack targets into solution directly and modify paths in csproj files so that we don’t need to change CI configuration, but that seems more like a hack.

Another approach would be to use Octo.exe pack or Nuget.exe pack as you suggested. I will give it a try.

Cheers,
Andrii

Hi Andrii,

In that case (1) building your app and sending it to a fixed location and then (2) packing it with Octo.exe pack or Nuget.exe pack would be what I’d recommend you to do in both .NET standard and .NET 4.6.1 scenarios.

Cheers,
Dalmiro