Author Topic: NETSDK1045 error  (Read 900 times)

MightyMonte88

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
NETSDK1045 error
« on: November 14, 2022, 07:02:32 am »
Hey y'all, I've finally found some time to update tech expansion and release the final version of it but I've hit a few snags...

After setting up a working directory just as i did last time, i get a single error with just the core game..

""Severity    Code    Description    Project    File    Line    Suppression State
Error    NETSDK1045    The current .NET SDK does not support targeting .NET 6.0.  Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0.    AtomicTorch.CBND.CoreMod    C:\Program Files\dotnet\sdk\5.0.414\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets    141
" is the exact error"

Here's a link to the guide i follow for setting up a working dir.
https://steamcommunity.com/sharedfiles/filedetails/?id=1707742469


I'm totally stumped, when creating a "working directory" according to the guide on steam i followed last time with success, and then creating a new cryofall mod project, i end up with 11 errors and 3 warnings... NU1104 multiple times, and the NETSDK1045 twice, once for each project

Its worth noting the old working directory i have still works with no errors, as does the old version of my mod


ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 2008
    • View Profile
Re: NETSDK1045 error
« Reply #1 on: November 14, 2022, 07:43:40 am »
Hello!
As an alternative solution, please try copying *.csproj and Header.xml file from "Core.cpk" to your mod folder and then edit these two files: change the ID/modtype/AssemblyName/RootNamespace. There are only a few lines and they're pretty clear.

Regards!

MightyMonte88

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
Re: NETSDK1045 error
« Reply #2 on: November 14, 2022, 08:17:34 am »
The NETSDK1045 error occures before any mod projects are loaded though..., with my working directory setup according to the guide i posted, i get the above-mentioned singular error when opening the solution/ building it.

Here's a screenshot of the error in VS19 with the solution open

Thanks for taking the time to help me with this AI.


https://tinypic.host/i/untitled.Smk7C


ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 2008
    • View Profile
Re: NETSDK1045 error
« Reply #3 on: November 14, 2022, 08:22:44 am »
Are you certain that you have .NET 6 SDK installed?
https://dotnet.microsoft.com/en-us/download/dotnet/6.0

Please also ensure that you have the latest CryoFall SDK in your working folder (you can always take the latest version from the "Core" subfolder in the game installation location).

MightyMonte88

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
Re: NETSDK1045 error
« Reply #4 on: November 14, 2022, 08:43:44 am »
So i do have 6.0 installed, but the download for 6.0 states the following....

"Using Visual Studio? This release is only compatible with Visual Studio 2022 (v17.0). Using a different version?"

So am i supposed to be using VS 2022 now?

Also, i have the latest version of the cryofall SDK installed for VS2019, but i did not have to physically place a copy of the in my working dir prior....im confused here. So to clerify...

https://marketplace.visualstudio.com/items?itemName=AtomicTorchStudio.cryofall-modding-sdk

I need to place a copy of that sdk, directly in my working directory ? Im totally lost now. Again, i followed the Modding prerequisites guide, and this steam guide https://steamcommunity.com/sharedfiles/filedetails/?id=1707742469, as i did last time, my old working dir with the old game version still works fine.

Heres a picture of the file structure in my working dir currently, after extracting the core VIA the command file, and then again manually to make sure the files were extracted correctly.

https://tinypic.host/i/working2.SmGYL

I tried to supply more pictures of the working dir, but for some reason im getting internal server errors when uploading to tinypic now lol.
This attempt feels ill fated.


Here's a pic from VS showing i have the latest SDK installed
https://tinypic.host/i/sdkinstalled.SmNba
« Last Edit: November 14, 2022, 08:53:27 am by MightyMonte88 »

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 2008
    • View Profile
Re: NETSDK1045 error
« Reply #5 on: November 14, 2022, 08:58:29 am »
Right, VS2022 is the way to go now. Perhaps latest version of VS Code is also fine, we've not tried.

The official CryoFall VS Extension is no longer useful (we're going to either remove it or add a message in the description explaining this). Currently we're using the new csproj format (aka ".NET SDK" format) instead of the old one (which VS used for almost two decades), the only requirement is fresh version of VS and .NET 6 SDK. With the new csproj format the old extension is no longer useful as new csproj format provides all the features we need (such as automatically including all the *.cs/.xml/.png/.jpg/.ogg/etc files in the VS project).
The only missing feature is one-click debugging of the running game with VS Debugger. However, you can use VS feature "Attach to process" (Ctrl+Alt+P) and it will work exactly like before.

Quote
I need to place a copy of that sdk, directly in my working directory ? Im totally lost now. Again, i followed the Modding prerequisites guide, and this steam guide https://steamcommunity.com/sharedfiles/filedetails/?id=1707742469, as i did last time, my old working dir with the old game version still works fine.
I'm not sure how your working directory is organized. I've re-read the guide now. If your working folder is just a carbon copy of the original "Core" subfolder (or the whole game) and your mod is inside either "Core" or "Mod" subfolder then everything is configured properly. The mod project will automatically locate CryoFall SDK (the actual path to the SDK is figured out by *.csproj file, see the lines with "<CryoFallSdk>").

Regards!

UPD. Yes, your working directory is looking good. You only need to install VS2022 with .NET 6 SDK.

MightyMonte88

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
Re: NETSDK1045 error
« Reply #6 on: November 14, 2022, 09:03:17 am »
Ah ok, sorry i didn't see the update to your post above.

Well i wish i had known that a day ago lol, so i'll ditch VS19 and the modding sdk extension, and install VS22
« Last Edit: November 14, 2022, 09:06:33 am by MightyMonte88 »

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 2008
    • View Profile
Re: NETSDK1045 error
« Reply #7 on: November 14, 2022, 09:06:24 am »
Yes, exactly. The guide in Steam is outdated. Install VS2022 with .NET 6 SDK and original Core.cpk will load and build without errors.

Also, if you're going to port your old mod you will also need to rewrite your csproj file to the new format (just take one from Core.cpk and change as necessary).

Regards!

MightyMonte88

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
Re: NETSDK1045 error
« Reply #8 on: November 14, 2022, 09:00:06 pm »
Alright, so with VS22 installed i am still getting an error, it's just a totally different error, as well as two warnings, here they are.


Severity   Code   Description   Project   File   Line   Suppression State
Error   NU1605   Detected package downgrade: Microsoft.Xaml.Behaviors.Wpf from 1.1.31 to 1.1.19. Reference the package directly from the project to select a different version.
 Core -> Noesis.GUI.Extensions 3.0.8 -> Microsoft.Xaml.Behaviors.Wpf (>= 1.1.31)
 Core -> Microsoft.Xaml.Behaviors.Wpf (>= 1.1.19)   AtomicTorch.CBND.CoreMod   C:\Users\adank\Desktop\CryofallWorkingDir\Cryofall\Core\Core.cpk\AtomicTorch.CBND.CoreMod.csproj   1   




The two warnings are as follows...

Severity   Code   Description   Project   File   Line   Suppression State
Warning   NETSDK1137   It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesk top SDK. Consider changing the Sdk attribute of the root Project element to 'Microsoft.NET.Sdk'.   AtomicTorch.CBND.CoreMod   C:\Program Files\dotnet\sdk\7.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets   153   

So this warning disappeared, while attempting to resolve the warning below ( NU1701 ), I re-installed .net 6.0 package, just to make absolutely sure it was installed correctly for vs22, and i guess that resolved THIS warning ( NETSDK1137 ) ? Either way, it's gone now.


Severity   Code   Description   Project   File   Line   Suppression State
Warning   NU1701   Package 'Noesis.GUI.Extensions 3.0.8' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net6.0-windows7.0'. This package may not be fully compatible with your project.   AtomicTorch.CBND.CoreMod   C:\Users\adank\Desktop\CryofallWorkingDir\Cryofall\Core\Core.cpk\AtomicTorch.CBND.CoreMod.csproj   1   

For this warning, it looks like i have to change the project's target framework , how do i go about doing that in vs22?
Edit: So i right clicked the project in the project explorer and went to properties, under properties its stating that the projects target framework is .NET 6.0, so im confused here....


Almost there lol, thanks for all the help so far AI, I'm looking forward to finishing this contribution to the cryofall community.
« Last Edit: November 14, 2022, 09:12:16 pm by MightyMonte88 »

Mars

  • Full Member
  • ***
  • Posts: 171
    • View Profile
Re: NETSDK1045 error
« Reply #9 on: November 14, 2022, 11:02:21 pm »
I read that you can still cheat VS2019 with Net6, as long as you have dotnet-sdk-6.01xx installed, then in my HardcoreDesert .csproj I manually changed the target to <TargetFramework>net6.0-windows</ TargetFramework>

(CryofallSdk)Sdk.props should also be <TargetFramework>net6.0-windows</TargetFramework>.

This way in the HardcoreDesert project, Cryofall core looks fine, I can use "go to definition" of all core objects.

The only warning is on Noesis.GUI.Extensions 3.0.8, but I don't think that's really useful

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 2008
    • View Profile
Re: NETSDK1045 error
« Reply #10 on: November 15, 2022, 05:10:58 am »
I'm not sure about "Microsoft.Xaml.Behaviors.Wpf" error as I cannot reproduce this issue.
You can edit "CryoFall.Mod.Sdk\Sdk.props" file to change the package version to 1.1.31 this way:
Code: [Select]
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.31" />
The warnings are safe to ignore.

Regards!
« Last Edit: November 15, 2022, 05:45:37 am by ai_enabled »

MightyMonte88

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
Re: NETSDK1045 error
« Reply #11 on: November 15, 2022, 06:53:40 am »
Alright got VS22 up and running with no errors, thanks guys big help.

Mars, i wish i had known that before uninstalled VS19 :P, if i hit any more snags with VS22 i might re-install 19 and use your work around.

Hey guys, so without the modding sdk extension, what option should i choose when creating a new project?

https://tinypic.host/i/newsetup.SxFvq
« Last Edit: November 15, 2022, 07:00:08 am by MightyMonte88 »