Skip to content

Build .NET projects with gmake #2513

@MrRobinOfficial

Description

@MrRobinOfficial

What's your question?
I’m working on a game engine that includes both C++ and C# projects managed with Premake. On Linux, I use gmake instead of vs2022. C++ projects build fine with gmake and GCC, but I cannot get C# projects to build.

Premake generates Makefiles that reference the csc compiler directly. On my Ubuntu WSL setup, I’m not sure if this is expected behavior, or whether the recommended approach nowadays is to use dotnet build instead of invoking Roslyn (csc) directly.

If csc is the correct tool, am I missing something in my setup? I have dotnet available in my environment path, but csc is only accessible via:

dotnet $DOTNET_ROOT/sdk/9.0.305/Roslyn/bincore/csc.dll

Creating a bash alias for csc doesn’t seem to work with the generated Makefiles.

Anything else we should know?

  • Is there a supported way to build .NET projects with Premake + gmake?
  • Or is the typical workflow to split managed/native projects, using vs2022 for managed and gmake for native builds?
  • Error I get when trying to build:
make[1]: csc: Not a directory
  • Code snippet from the makefile:
ifeq ($(config),debug)
  CSC = csc
  RESGEN = resgen

// ...

$(TARGET): $(SOURCES) $(EMBEDFILES) $(DEPENDS) $(RESPONSE) | $(TARGETDIR)
	$(PRELINKCMDS)
	$(SILENT) $(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) @$(RESPONSE) $(patsubst %,/resource:%,$(EMBEDFILES))
	$(POSTBUILDCMDS)

Any solutions, tips, or recommended practices would be very helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions