[ENH] Override default publish folder name
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.
Sure, why not. If it eliminates confusions then I am for it.
What about having json file that specifies what assembly should be loaded?
@SupinePandora43 What do you mean? Can you elaborate?
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.
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.