UndeadEmo
UndeadEmo

Reputation: 523

upgrading from .net framework 4.7.2 to net 6 using upgrade-assistant upgrades to .net standard 2.0 instead

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

Upvotes: 6

Views: 13309

Answers (3)

Andreycw
Andreycw

Reputation: 93

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.

Upvotes: 0

Jackys
Jackys

Reputation: 117

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

Upvotes: 1

UndeadEmo
UndeadEmo

Reputation: 523

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

Upvotes: 2

Related Questions