Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 418 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nuget re-targeting after upgrading from .Net Framework 4.5 to 4.6.1

#1
I have a .net solution with approx 30 projects, all of them targeting .Net Framework 4.5. and each referencing at least 3-4 NuGet packages.

We now need to update them to .Net Framework 4.6.1. So here's what I need to know:

1. Do I need to re-target the NuGet packages as well or can I skip that since this will be an 'in-place' upgrade?
2. If yes, can I just update the packages.config file for each project by replacing targetFramework="net45" with targetFramework="net461" for each NuGet package? I've seen a few threads recommending uninstall and then reinstall the package via 'update-package' command. I tried that today but it I ended up with a few errors.
Reply

#2
The packages will not be retargeted automatically, but there is an automated fix for this.

In Package Manager Console simply run:

<!-- language: default -->

Update-Package -Reinstall

This will force the package manager to reinstall every package in every project (without changing the version of the referenced package).

By reinstalling the packages after the new framework is targeted this changes all the references to the correct version.

You may also run this against a single project with :

<!-- language: default -->

Update-Package -Reinstall -ProjectName Project.Name.Here

I have used this technique many times to fix nuget reference issues.

Reply

#3
Fixed by using -

Update-Package -reinstall

[![enter image description here][1]][1]


[1]:
Reply

#4
1 Find all .csproj files and replace

<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>

with

<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>

2 Open Package Manager Console and run

Update-Package -Reinstall -IgnoreDependencies

3 Find all solutions then msbuild each one.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through