Challenges converting a C/C++ project from VS2019 to VS2022 (ResolveNuGetPackageAssets-edition)

Challenges converting a C/C++ project from VS2019 to VS2022 (ResolveNuGetPackageAssets-edition)

25th October 2023 by Admin

Do you want to upgrade to the latest Visual Studio edition? Then you probably recognize the sneaking feeling that this might not work at first!

Recently I wanted to upgrade an older C/C++ project from compiling- and building fine in Visual Studio 2019, to the latest and greatest Visual Studio 2022.

The first Rebuild generated the following never-seen-it-before-message:

image

Click on the image above for a full size image

The error message origins from MSBuild and NuGet, which I am not too used to see when working with my C/C++ projects. NuGet is a package manager for the Microsoft development platform including .NET. But hey, this is not a .NET solution!

As always when encountering challenges like this, you head to the internet. ChatGPT didn’t quite catch the problem either, albeit it was giving me good advice on how to set the Check and Update any NuGet packages (which was none), check and set the Target Framework and other typical .NET related stuff.

One of the best sites for developer questions is StackOverflow, and yet again it delivered. The answer found here https://stackoverflow.com/a/73626823, Borislav Ivanov comes up with a working solution for the project. Note that my projects already uses the  Directory.Build.props file to control build settings:

image

The lines from the article above are:


 
< /ItemGroup>


  native,Version=v0.0
< /PropertyGroup>

… and I place them inside the Directory.Build.props file at topmost level. Note that I my Directory.Build.props is located at the top-level C/C++ directory, meaning that all my C/C++ projects are further down in the directory hierarchy. I do not want this change into my C#/.NET projects, since NuGet is very much in use there.

Now the old VS2019-code builds fine in VS2022!


Login to post a comment

Challenges converting a C/C++ project from VS2019 to VS2022 (ResolveNuGetPackageAssets-edition)

Challenges converting a C/C++ project from VS2019 to VS2022 (ResolveNuGetPackageAssets-edition)

25th October 2023 by Admin

Do you want to upgrade to the latest Visual Studio edition? Then you probably recognize the sneaking feeling that this might not work at first!

Recently I wanted to upgrade an older C/C++ project from compiling- and building fine in Visual Studio 2019, to the latest and greatest Visual Studio 2022.

The first Rebuild generated the following never-seen-it-before-message:

image

Click on the image above for a full size image

The error message origins from MSBuild and NuGet, which I am not too used to see when working with my C/C++ projects. NuGet is a package manager for the Microsoft development platform including .NET. But hey, this is not a .NET solution!

As always when encountering challenges like this, you head to the internet. ChatGPT didn’t quite catch the problem either, albeit it was giving me good advice on how to set the Check and Update any NuGet packages (which was none), check and set the Target Framework and other typical .NET related stuff.

One of the best sites for developer questions is StackOverflow, and yet again it delivered. The answer found here https://stackoverflow.com/a/73626823, Borislav Ivanov comes up with a working solution for the project. Note that my projects already uses the  Directory.Build.props file to control build settings:

image

The lines from the article above are:


 
< /ItemGroup>


  native,Version=v0.0
< /PropertyGroup>

… and I place them inside the Directory.Build.props file at topmost level. Note that I my Directory.Build.props is located at the top-level C/C++ directory, meaning that all my C/C++ projects are further down in the directory hierarchy. I do not want this change into my C#/.NET projects, since NuGet is very much in use there.

Now the old VS2019-code builds fine in VS2022!


Login to post a comment