@@ -133,14 +133,32 @@ fn create_nuget_config(sources: &[(String, PathBuf)], mappings: &[(String, Strin
133133
134134/// Override nuget config to use a local NuGet package on a .NET project.
135135fn override_nuget_package ( project_dir : & Path , package : & str , source_dir : & Path , build_subdir : & str ) -> Result < ( ) > {
136+ override_nuget_package_from_project ( project_dir, package, source_dir, None , build_subdir)
137+ }
138+
139+ /// Override nuget config to use a local NuGet package built from a specific .NET project.
140+ fn override_nuget_package_from_project (
141+ project_dir : & Path ,
142+ package : & str ,
143+ source_dir : & Path ,
144+ source_project : Option < & str > ,
145+ build_subdir : & str ,
146+ ) -> Result < ( ) > {
136147 println ! ( "Override {package}: {project_dir:?} with {source_dir:?}" ) ;
137148
138149 // Make sure the local package is built
139150 let workspace = workspace_root ( ) ;
140151 let repo_nuget_config = workspace. join ( "NuGet.Config" ) ;
152+ let source_project_path = source_project. map ( |project| source_dir. join ( project) ) ;
141153 if repo_nuget_config. exists ( ) {
142- let output = Command :: new ( "dotnet" )
143- . args ( [ "restore" , "--configfile" , repo_nuget_config. to_str ( ) . unwrap ( ) ] )
154+ let mut command = Command :: new ( "dotnet" ) ;
155+ command. arg ( "restore" ) ;
156+ if let Some ( source_project_path) = & source_project_path {
157+ command. arg ( source_project_path) ;
158+ }
159+ let output = command
160+ . arg ( "--configfile" )
161+ . arg ( & repo_nuget_config)
144162 . current_dir ( source_dir)
145163 . output ( )
146164 . context ( "Failed to run dotnet restore" ) ?;
@@ -152,8 +170,13 @@ fn override_nuget_package(project_dir: &Path, package: &str, source_dir: &Path,
152170 ) ;
153171 }
154172
155- let output = Command :: new ( "dotnet" )
156- . args ( [ "pack" , "-c" , "Release" , "--no-restore" ] )
173+ let mut command = Command :: new ( "dotnet" ) ;
174+ command. arg ( "pack" ) ;
175+ if let Some ( source_project_path) = & source_project_path {
176+ command. arg ( source_project_path) ;
177+ }
178+ let output = command
179+ . args ( [ "-c" , "Release" , "--no-restore" ] )
157180 . current_dir ( source_dir)
158181 . output ( )
159182 . context ( "Failed to run dotnet pack" ) ?;
@@ -165,8 +188,13 @@ fn override_nuget_package(project_dir: &Path, package: &str, source_dir: &Path,
165188 ) ;
166189 }
167190 } else {
168- let output = Command :: new ( "dotnet" )
169- . args ( [ "pack" , "-c" , "Release" ] )
191+ let mut command = Command :: new ( "dotnet" ) ;
192+ command. arg ( "pack" ) ;
193+ if let Some ( source_project_path) = & source_project_path {
194+ command. arg ( source_project_path) ;
195+ }
196+ let output = command
197+ . args ( [ "-c" , "Release" ] )
170198 . current_dir ( source_dir)
171199 . output ( )
172200 . context ( "Failed to run dotnet pack" ) ?;
@@ -637,10 +665,11 @@ log = "0.4"
637665 & workspace. join ( "crates/bindings-csharp/BSATN.Runtime" ) ,
638666 "bin/Release" ,
639667 ) ?;
640- override_nuget_package (
668+ override_nuget_package_from_project (
641669 client_path,
642670 "SpacetimeDB.ClientSDK" ,
643671 & workspace. join ( "sdks/csharp" ) ,
672+ Some ( "SpacetimeDB.ClientSDK.csproj" ) ,
644673 "bin~/Release" ,
645674 ) ?;
646675
0 commit comments