Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating to .NET 6.0 error on publish: Assets file doesn't have a target for 'net5.0'

I'm trying to migrate from .NET 5 to .NET 6. I've installed VS 2022 Community Preview and the Hosting Bundle... and updated everything in NuGet. The project will build without errors but when I go to publish it, I get the following error:

Assets file 'D:\Data\CADE.core\FileManager\FileManager\obj\project.assets.json' doesn't have a target for 'net5.0'. 
Ensure that restore has run and that you have included 'net5.0' in the TargetFrameworks for your project.

I don't know why it's still looking for .NET 5 nor how to fix this error.

like image 230
Velocedge Avatar asked Dec 13 '25 06:12

Velocedge


1 Answers

With everyone's help, I found the solution. I edited the publishing information and there was a red dot by Target Framework net6.0. I clicked the drop-down and one of the options was "net6.0-windows". I selected that and it published correctly.

like image 166
Velocedge Avatar answered Dec 14 '25 20:12

Velocedge



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!