Cannot run `spacetime publish` when csproj + sln live in same folder
I've been going through https://spacetimedb.com/docs/unity/part-3.
When opening the server-csharp folder in VS Code:
cd C:\dev\unity-games\blackholio\server-csharp
code .
It (C# DevKit?) automatically creates a server-csharp.sln file in the same folder as StdbModule.csproj.
After this, if I run spacetime publish --server local blackholio I get an error:
MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.
Error: command ["dotnet", "publish", "-c", "Release", "-v", "quiet"] exited with code 1
There is no way to specify that StdbModule.csproj should be built.
--build-options is only used to specify additional options to the spacetime build command which gets invoked as part of spacetime publish.
Static dotnet publish execution:
https://github.com/clockworklabs/SpacetimeDB/blob/651f79d22cc4bb1c3c996ef2436186501a5d83bd/crates/cli/src/tasks/csharp.rs#L70C5-L70C65
Just put it in a directory (module in blow). like this:
│ spacetimedb.sln
│
└─── module
.gitignore
global.json
Lib.cs
StdbModule.csproj
Just put it in a directory (module in blow). like this:
│ spacetimedb.sln │ └─── module .gitignore global.json Lib.cs StdbModule.csproj
That works, too. I just created a PowerShell script to temporarily rename the sln-file before invoking spacetime CLI.
To avoid others having the same problem, it may make sense to fix it at the source 😊.
Will fix, ticket has been triaged 👍
It (C# DevKit?) automatically creates a server-csharp.sln file in the same folder as StdbModule.csproj.
VS Code also has a setting to prevent this, which is disabled by default: Dotnet: Preview Solution-free Workspace Mode