premake / premake-core

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

Updating dotnetframework function #1953

Open anthofoxo opened 1 year ago

anthofoxo commented 1 year ago

The dotnetframework function is a little dated following the releases of .NET5 and 6. Specifying 6 or 6.0 does not work currently.

When using current latest of 4.6 to generate the project and workspace; Visual studio does not provide a way to upgrade from 4.6 to .NET6 using either vs2019 or vs2022 as the action

Additionally setting csversion to 11 for .NET6 does not change the selected framework for the version.

After looking into details. .NET5 and 6 use the TargetFramework xml tag instead of TargetFrameworkVersion for older versions

nickclark2016 commented 1 year ago

I think this is a noted bug somewhere that I've got on my backlog. Once I try to take care of some of the Makefile and C++ related bugs, I'll delve into this again. If I recall, it was a bit tricky, unfortunately.

anthofoxo commented 1 year ago

I dug into some changes that would be needed to get this working, I havnt looked into premake source code yet, just what needs changed in the xml. So starting in .net6 <TargetFrameworkVersion>v6.0</TargetFrameworkVersion> needs to change into <TargetFramework>net6.0</TargetFramework>

Next the import statements must go away

The main project line gets changed into this simpler line <Project Sdk="Microsoft.NET.Sdk">

Since net6 has default compile options, <EnableDefaultCompileItems>false</EnableDefaultCompileItems> this property will need added to the default property group to allow premake to do what it wants with compiling

I'll take a deeper dive into source and if i get something working ill update the issue