premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.24k stars 617 forks source link

C++/CLI Targeting Net6.0 #1871

Open Laocoon7 opened 2 years ago

Laocoon7 commented 2 years ago

What seems to be the problem? An invalid string is written to the "targetframework" configuration when targeting net6.0 with a c++/cli project.

clr "on"
dotnetframework "net6.0"

This causes the project to not load in VisualStudio2022.

What did you expect to happen? Be able to load the project in VisualStudio and: Project "Configuration Properties->Advanced->C++/CLI Properties->.NET Core Target Framework" to be set to "net6.0"

What have you tried so far? This is probably related to issue #1865

How can we reproduce this?

workspace "Citadel"
    configurations { "Debug", "Release" }

    project "VKR"
    kind "SharedLib"
    language "C++"
    clr "NetCore"
    dotnetframework "net6.0"

What version of Premake are you using? premake5.0.0-beta1

Anything else we should know? The error message:

[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries(_.vnet6.0, '', x64, '')' cannot be evaluated. Input string was not in a correct format. $RelativePath\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets

This seems like the commit to add net5.0+ https://github.com/premake/premake-core/commit/cada88b037bdcdba0cd5efdc82a440bc44f1e5b8

nickclark2016 commented 2 years ago

Late follow up, but could you confirm if this is an issue just affecting your VS2022 install versus older versions of Visual Studio? This appears to be an issue with how the CLR version is emitted in the project file.