diff --git a/sdks/csharp/SpacetimeDB.ClientSDK.Godot.csproj b/sdks/csharp/SpacetimeDB.ClientSDK.Godot.csproj index 61e3cda1f0e..91113475b3d 100644 --- a/sdks/csharp/SpacetimeDB.ClientSDK.Godot.csproj +++ b/sdks/csharp/SpacetimeDB.ClientSDK.Godot.csproj @@ -19,7 +19,7 @@ 2.3.0 2.3.0 $(DefaultItemExcludes);*~/** - packages + obj~/godot/packages true $(DefineConstants);GODOT diff --git a/tools/regen/src/csharp.rs b/tools/regen/src/csharp.rs index 5622d23012d..f0e1c532293 100644 --- a/tools/regen/src/csharp.rs +++ b/tools/regen/src/csharp.rs @@ -7,7 +7,6 @@ use std::fs; use std::path::{Path, PathBuf}; const BSATN_PACKAGE_ID: &str = "spacetimedb.bsatn.runtime"; -const GODOTSHARP_PACKAGE_ID: &str = "godotsharp"; const RUNTIME_PACKAGE_ID: &str = "spacetimedb.runtime"; fn workspace_dir() -> PathBuf { @@ -117,7 +116,7 @@ fn clear_restored_package_dirs(pkg_id: &str) -> Result<()> { Ok(()) } -fn clear_godot_intermediate_outputs() -> Result<()> { +fn clear_godot_regen_dir() -> Result<()> { let godot_obj_dir = sdk_dir().join("obj~/godot"); if godot_obj_dir.exists() { fs::remove_dir_all(&godot_obj_dir)?; @@ -219,10 +218,11 @@ pub fn regen_dlls() -> Result<()> { clear_restored_package_dirs(RUNTIME_PACKAGE_ID)?; // Some Unity runners have had partially restored GodotSharp package state in the past. - // Clear the package and restore outputs so NuGet cannot reuse assets missing GodotSharp.dll. + // Godot restores packages under obj~/godot/packages, so clearing obj~/godot removes + // both intermediates and Godot-only packages without touching Unity-visible packages. + // This prevents NuGet from reusing assets missing GodotSharp.dll. // See https://github.com/clockworklabs/SpacetimeDB/pull/5133 for more details. - clear_restored_package_dirs(GODOTSHARP_PACKAGE_ID)?; - clear_godot_intermediate_outputs()?; + clear_godot_regen_dir()?; cmd!( "dotnet", @@ -244,6 +244,7 @@ pub fn regen_dlls() -> Result<()> { "-p:BaseOutputPath=bin~/", "-p:BaseIntermediateOutputPath=obj~/godot/", "-p:MSBuildProjectExtensionsPath=obj~/godot/", + "-p:RestorePackagesPath=obj~/godot/packages", ) .dir(&sdk) .run()?; @@ -272,7 +273,8 @@ pub fn regen_dlls() -> Result<()> { "-p:BaseOutputPath=bin~/", // TODO: It should be possible to put this in Directory.Build.props, but it caused CI failures when we did. "-p:BaseIntermediateOutputPath=obj~/godot/", - "-p:MSBuildProjectExtensionsPath=obj~/godot/" + "-p:MSBuildProjectExtensionsPath=obj~/godot/", + "-p:RestorePackagesPath=obj~/godot/packages", ) .dir(&sdk) .run()?;