NETSDK1045 error

Started by MightyMonte88, 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.

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


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.



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.


Are you certain that you have .NET 6 SDK installed?

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).


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 confused here. So to clerify...

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, 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.

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


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.

QuoteI 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, 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>").


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


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


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).



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.WindowsDesktop 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.


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


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:
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.31" />

The warnings are safe to ignore.



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?