Skip to content

Cannot run spacetime publish when csproj + sln live in same folder #2599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AndreasHassing opened this issue Apr 12, 2025 · 4 comments
Open

Comments

@AndreasHassing
Copy link

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

@m-nt
Copy link

m-nt commented Apr 13, 2025

Just put it in a directory (module in blow).
like this:

│  spacetimedb.sln
│
└─── module
        .gitignore
        global.json
        Lib.cs
        StdbModule.csproj

@AndreasHassing
Copy link
Author

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 😊.

@jdetter
Copy link
Collaborator

jdetter commented Apr 13, 2025

Will fix, ticket has been triaged 👍

@PatrekurTh
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants