5

I am trying to upgrade projects inside a solution from .net framework 4.7.2 to net6.0 however after the first project (class library) has been upgraded it results in .net standard 2.0 not net 6.0. The Assistant version being used is (version '0.3.261602'). I;ve also installed the net 6 sdk

i am using the commands provided Here

below are the commands ive tried and the results

upgrade-assistant upgrade --target-tfm-support lts "C:\Users\..\..\mySolution.sln" 
upgrade-assistant upgrade --target-tfm-support "C:\Users\..\..\mySolution.sln"

both commands result in upgrades to .net standard 2.0

upgrade-assistant upgrade --target-tfm-support latest "C:\Users\..\..\mySolution.sln" 

error: Cannot parse argument 'latest' for option '--target-tfm-support' as expected type Microsoft.DotNet.UpgradeAssistant.UpgradeTarget.

upgrade-assistant upgrade --target-tfm-support net6.0 "C:\Users\..\..\mySolution.sln" 

error: Cannot parse argument 'net6.0' for option '--target-tfm-support' as expected type Microsoft.DotNet.UpgradeAssistant.UpgradeTarget.

below is result after project was upgraded

1. [Complete] Back up project
2. [Complete] Convert project file to SDK style
3. [Complete] Clean up NuGet package references
4. [Complete] Update TFM
5. [Complete] Update NuGet Packages
6. [Complete] Add template files
7. [Complete] Upgrade app config files
    a. [Complete] Convert Application Settings
    b. [Complete] Convert Connection Strings
    c. [Complete] Disable unsupported configuration sections
8. [Complete] Update source code
    a. [Complete] Apply fix for UA0002: Types should be upgraded
    b. [Complete] Apply fix for UA0012: 'UnsafeDeserialize()' does not exist
9. [Next step] Move to next project
UndeadEmo
  • 433
  • 1
  • 6
  • 15

3 Answers3

2

Ok so i think it may do this if there are refrences to nuget packages which are still pointing to .net framework. but in i=eiterh case swicthing it from .net standard to .net 6 worked

UndeadEmo
  • 433
  • 1
  • 6
  • 15
  • I'm experiencing the same problem with **.NET 4.6.1**. After you changed the project settings from netstandard to net6.0, is the project compiled successfully and refer the net6.0 libraries? – wonderful world Apr 12 '22 at 02:36
  • I'm experiencing the same problem with .NET Framework 4.8. Any proper solution? @UndeadEmo – LakShan May 27 '22 at 12:23
1

Let your upgrade complete, then click edit project file and change your TargetFramework from netstandard 2.0 to Net 6.0. Build you project it will start support to .Net 6.0.

enter image description here

Jackys
  • 107
  • 11
0

TLDR:
a. run upgrade-assistant upgrade it will upgrade to net 7.
b. run upgrade-assistant upgrade --target-tfm-support lts it will upgrade to net 6.

Latest and net6.0 are not valid options, thus you were getting error. It only accept STS, LTS and Preview. May check the options section

upgrade-assistant upgrade --target-tfm-support lts

Based on the source code, it has updated 'LTS' to use net 6 (by default) at the time I commented here. Kindly check the upgrade-assistant version used, i am using 0.4.421302.

Andreycw
  • 63
  • 1
  • 5