GmodDotNet icon indicating copy to clipboard operation
GmodDotNet copied to clipboard

[ENH] Override default publish folder name

Open GlebChili opened this issue 4 years ago • 5 comments

Description

When loading module by name, module and its dependencies must be placed in garrysmod/lua/bin/Modules/ModuleName where ModuleName is exactly module's main assembly name. Any typo in folder name will make module load process impossible. We can override default publish folder name from publish to publish/$(AssemblyName). For example, for a module with name TestModule, the output of dotnet publish TestModule.csproj -c Release will be located at bin\Debug\net5.0\publish\TestModule and one can simply copy folder to Modules or ship to another machine or user without fear of typos.

Technical implementation

We can add GmodNET.API.props file to a GmodNET.API NuGet package, so any project referencing API will have its publish dir name overridden. Since .props files are imported before the main body of the project file, developers can override publish dir name themself one more time.

GlebChili avatar Jul 18 '21 01:07 GlebChili

Sure, why not. If it eliminates confusions then I am for it.

Stat1cV01D avatar Jul 18 '21 01:07 Stat1cV01D

What about having json file that specifies what assembly should be loaded?

SupinePandora43 avatar Jul 18 '21 15:07 SupinePandora43

@SupinePandora43 What do you mean? Can you elaborate?

GlebChili avatar Jul 19 '21 03:07 GlebChili

What about having json file that specifies what assembly should be loaded?

Do you mean to have the user add an additional configuration .json?

E.g: mymodule.json

{
    "startup": "MyDllName.dll"
}

?

If that is what you mean I'd be against that since it adds a layer of complexity. I agree with @Stat1cV01D that elimination of confusion is something to go for. I believe adding another json is just something else you can forget as a new developer.

luttje avatar Jul 19 '21 08:07 luttje

It seems like implementing this with only NuGet .props and .targets is not possible due to the properties evaluation order. We can fix achieve desired behavior by writing our own SDK, but this can wait for future releases.

GlebChili avatar Jul 19 '21 22:07 GlebChili