PackageReferenceUpgrader icon indicating copy to clipboard operation
PackageReferenceUpgrader copied to clipboard

Tool runs on .net framework projects

Open PhilPJL opened this issue 7 years ago • 8 comments

Installed product versions

  • Visual Studio: 2017 (15.5.0)

Description

This page https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files says

Important At present, package references are supported in Visual Studio 2017 only, for .NET Core projects, .NET Standard projects, and UWP projects targeting Windows 10 Build 15063 (Creators Update).

Yet I can run it on any project type.

PhilPJL avatar Oct 13 '17 13:10 PhilPJL

I think this documentation is incorrect, as I have it installed on .NET Framework projects with no problem. @davkean, those references can work anywhere in VS2017, right?

robertmclaws avatar Oct 13 '17 13:10 robertmclaws

I'm thinking the documentation is correct. I ran your tool on a .net framework web app. It now fails to build

image

I'm assuming this looks correct

image

PhilPJL avatar Oct 13 '17 17:10 PhilPJL

I'm using it on a .NET Framework-based Web Project, and it's totally fine. You appear to be missing a reference to System.Web.Http. You might need to re-add the Assembly Reference to System.Web.Http from the "Add Reference" dialog. (I don't believe there is a NuGet package for that one.)

robertmclaws avatar Oct 15 '17 18:10 robertmclaws

Robert, I got a test scenario to work, but there may be an issue or two for you to fix. Try this:

  1. create a new MVC web app
  2. updated all NuGet packages (packages.config)
  3. changed tools/options/nugget package manager to use packagereference

image

  1. run your upgrader

  2. close vs/open vs/build clean

  3. do a build - which fails

  4. Downgrade one Nuget package and update it again. All of the package references now appear in solution explorer. Build succeeds.

I tried the scenario again. This time I left one package that needed to be updated before I ran your upgrader. The references in solution explorer at this point are not package references (they aren't the little blue icon). Update the remaining Nuget package and they all change. Builds ok.

PhilPJL avatar Oct 15 '17 19:10 PhilPJL

Can you please tell me the options you selected for creating a new MVC app? .NET Framework or Core? Which version?

Also, I would assume "allow format selection" is what is blocking you... if you uncheck that, I would assume it would use PackageReference and not give you a choice as those packages are restored. But that could be a VS bug.

Finally, you shouldn't need to close and restart VS in order for my tool to work. It should prompt you to reload the solution, at which point you should rebuild and be fine.

Thanks!

robertmclaws avatar Oct 15 '17 20:10 robertmclaws

Using VS 2017 15.4.0 Create new 'ASP.NET Web Application (.NET Framework)' .NET 4.7 MVC, No authentication, No unit tests.

PhilPJL avatar Oct 15 '17 20:10 PhilPJL

Tried unchecking 'allow format selection'. No difference.

PhilPJL avatar Oct 15 '17 20:10 PhilPJL

I'm on the 14.5 preview and I could not reproduce. My defaults were already set to PackageReference.

I would say this. Why download package updates before upgrading? Create the new project, upgrade the PackageReferences, THEN build. Even if VS has a bug with the PackageReferences with the first load, you're off package.config right away, the packages aren't downloaded yet, and they'll install when you build the first time. Then update after that.

I'm not sure if I can do anything about this, because I'm not sure it's a problem in my upgrader. I will keep an eye on reports though.

robertmclaws avatar Oct 15 '17 21:10 robertmclaws