Closed peter1745 closed 2 years ago
I haven't had a chance to test this out, but what happens if you only specify architecture "x64"
for the C++ project? Move the line down ~10 lines in the Premake script.
@samsinsane I tested it, and moving the architecture down to the project scope worked. It now generates the Any CPU platform, and properly detects that we're using a mix of platforms. I still think this is a bug though, since architecture is supposed to work on both the project, and workspace level. And having architecture on the workspace level was definitely working prior to the beta1. I'm not sure but has that changed? The example for architecture in the docs shows that it can be used on the workspace level.
Especially since it would be really annoying to have to copy the architecture to every single C++ project in the workspace (I'm working on a project where we have a lot of C++ projects in the workspace)
I still think this is a bug though, since architecture is supposed to work on both the project, and workspace level.
Specifying architecture
at the workspace level is still working. Your issue indicates that you wanted Any CPU
while specifying x64
, that doesn't make any sense, Premake generated what you requested.
And having architecture on the workspace level was definitely working prior to the beta1.
I don't really understand what this means. Beta1 added support for VS2022, and your comment above suggests that everything still works for VS2019. It doesn't sound like anything broke in Premake, but that either VS2022 no longer supports x64 C# projects or your VS2022 install is broken. If it's the former then Premake will need to be updated to reflect that change, but otherwise I don't believe anything has broken or changed in Premake that would cause the problem you're seeing.
Especially since it would be really annoying to have to copy the architecture to every single C++ project in the workspace (I'm working on a project where we have a lot of C++ projects in the workspace)
Instead of moving it, change it to this maybe? (Untested, but it should work)
filter { "language:C++" }
architecture "x64"
filter {}
Ah, yeah I think VS2022 (or maybe .NET 6) dropped support for x64 target platforms. In that case premake will need to reflect that, but yes you're right it's probably because they dropped support for it
What seems to be the problem? When you generate a Visual Studio 2022 solution (using vs2022 build action) that has an
architecture
specified, and a .NET 5/6 project as well as a C++ project, the solution won't contain the "Mixed Platforms" platform. Meaning you can't build the C# project because the "Any CPU" platform doesn't exist. Instead it just generates whateverarchitecture
is set to. From what I can tell this means that you can't really have a x64 platform when a C# project is present in the solution, since premake generates a Win32 platform ifarchitecture
isn't set on Windows.What did you expect to happen? I expected the solution to have either "Mixed Platforms" in the SolutionConfigurationPlatforms section, or an x64 AND Any CPU platform, and for the CSProject project to have "Any CPU" set as the target platform. I expected the .sln file to looks something like this:
What have you tried so far? I was able to workaround it by simply creating the "Any CPU" platform in the Configuration Manager. You can also remove the
architecture
field from the workspace, which would cause premake to generate a Win32 platform, and a Any CPU platform.How can we reproduce this? Here's the premake script I used to generate the solution:
Running this premake script with vs2022 as the action should give you a .sln file that looks something like this:
What version of Premake are you using? I'm using 5.0.0-dev, and as of this issue it's up to date with the master branch.
Anything else we should know? I also tried running the script with vs2019 as the action, and it gave me the same .sln file, but when I open it in Visual Studio 2019 it works just fine. I also tried manually creating a solution with a C++ and C# project through Visual Studio 2022, and it gave both the x64 AND Any CPU platforms.