premake / premake/premake-core

Generating C# projects does not set the platform target correctly

Open
#1,963 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Description

What seems to be the problem?
Generating a C# project using premake does not specify the "Platform Targets" property for the project when an architecture is specified. This results in projects being still marked as "AnyCPU" regardless of the specified architecture.

What did you expect to happen?
The generated csproj should contain a "Platforms" tag in the condition-less PropertyGroup. For example, if the architecture is x64, it should have the following tag: <Platforms>x64</Platforms>.

What have you tried so far?
Manually inserting the <Platforms>x64</Platforms> tag.

How can we reproduce this?
Only tested with VS 2019 so far with the following premake file.

project "SHADE_CSharp"
  architecture "x64"
  kind "SharedLib"
  language "C#"
  clr "NetCore"
  dotnetframework "net5.0"
  targetdir (outputdir)
  objdir    (interdir)
  systemversion "latest"

  files  
  {
    "%{prj.location}/src/**.cs",
    "%{prj.location}/src/**.tt"
  }

  flags
  {
  	"MultiProcessorCompile"
  }

  dependson
  {
    "SHADE_Engine"
  }

  warnings 'Extra'
  
  filter "configurations:Debug"
    symbols "On"
    defines {"_DEBUG"}
  
  filter "configurations:Release"
    optimize "On"
    defines{"_RELEASE"}

  • Visual Studio 2022 (vs2022)
  • Visual Studio 2019 (vs2019)
  • Visual Studio 2017 (vs2017)
  • Visual Studio 2015 (vs2015)
  • Visual Studio 2012 (vs2012)
  • Visual Studio 2010 (vs2010)
  • Visual Studio 2008 (vs2008)
  • Visual Studio 2005 (vs2005)
  • GNU Makefile (gmake)
  • GNU Makefile 2 (gmake2)
  • XCode (xcode)
  • Codelite
  • Other (Please list below)

What version of Premake are you using?
5.0.0-beta2

Anything else we should know?
None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the supplied premake project using the Visual Studio 2019 generator, then inspect the generated .csproj and the C# project-generation path handling architecture. Done means an x64 project includes a condition-less x64 tag and no longer remains AnyCPU; compare the generated output across the relevant configurations.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.