@@ -72,11 +72,22 @@ private static void LogHeader(string message)
7272 Target Clean => _ => _
7373 . Executes ( ( ) =>
7474 {
75+ // Clean artifacts directory (contains all build output and obj files)
7576 if ( Directory . Exists ( ArtifactsDirectory ) )
7677 Directory . Delete ( ArtifactsDirectory , true ) ;
77- var binDirs = Directory . GetDirectories ( RootDirectory / "src" , "bin" , SearchOption . AllDirectories ) ;
78- var objDirs = Directory . GetDirectories ( RootDirectory / "src" , "obj" , SearchOption . AllDirectories ) ;
79- foreach ( var dir in binDirs . Concat ( objDirs ) )
78+
79+ // Clean any legacy bin/obj directories in src (for backwards compatibility)
80+ var legacyBinDirs = Directory . GetDirectories ( RootDirectory / "src" , "bin" , SearchOption . AllDirectories ) ;
81+ var legacyObjDirs = Directory . GetDirectories ( RootDirectory / "src" , "obj" , SearchOption . AllDirectories ) ;
82+ foreach ( var dir in legacyBinDirs . Concat ( legacyObjDirs ) )
83+ {
84+ Directory . Delete ( dir , true ) ;
85+ }
86+
87+ // Clean legacy bin/obj directories in tests
88+ var testBinDirs = Directory . GetDirectories ( RootDirectory / "tests" , "bin" , SearchOption . AllDirectories ) ;
89+ var testObjDirs = Directory . GetDirectories ( RootDirectory / "tests" , "obj" , SearchOption . AllDirectories ) ;
90+ foreach ( var dir in testBinDirs . Concat ( testObjDirs ) )
8091 {
8192 Directory . Delete ( dir , true ) ;
8293 }
@@ -113,11 +124,11 @@ private static void LogHeader(string message)
113124 . Executes ( ( ) =>
114125 {
115126 var hostProjectName = EffectiveTargetHost == "blazor" ? BlazorHostProject : AvaloniaHostProject ;
116- var outputDir = ArtifactsDirectory / hostProjectName ;
117127
118- var executable = outputDir / hostProjectName ;
128+ // All binaries are now in artifacts/ (unified output path)
129+ var executable = ArtifactsDirectory / hostProjectName ;
119130 if ( OperatingSystem . IsWindows ( ) )
120- executable = outputDir / $ "{ hostProjectName } .exe";
131+ executable = ArtifactsDirectory / $ "{ hostProjectName } .exe";
121132
122133 if ( ! File . Exists ( executable ) )
123134 {
@@ -129,11 +140,11 @@ private static void LogHeader(string message)
129140 LogHeader ( $ "Running { hostProjectName } ") ;
130141 LogHighlight ( $ "Executable: { executable } ") ;
131142
132- // Run the application
143+ // Run the application from artifacts directory
133144 var process = System . Diagnostics . Process . Start ( new System . Diagnostics . ProcessStartInfo
134145 {
135146 FileName = executable ,
136- WorkingDirectory = outputDir ,
147+ WorkingDirectory = ArtifactsDirectory ,
137148 UseShellExecute = false
138149 } ) ;
139150
@@ -166,7 +177,7 @@ private static void LogHeader(string message)
166177 // ============================================================
167178
168179 /// <summary>
169- /// Just compile the solution (no publish/package )
180+ /// Just compile the solution (default bin/Debug output )
170181 /// </summary>
171182 Target Compile => _ => _
172183 . DependsOn ( Restore )
@@ -180,12 +191,13 @@ private static void LogHeader(string message)
180191 } ) ;
181192
182193 /// <summary>
183- /// Build and publish host application to artifacts/
194+ /// Build host application to artifacts/
195+ /// OutputPath is configured in each .csproj file
184196 /// Usage: nuke build-app [--target-host avalonia|blazor|all]
185197 /// </summary>
186198 Target BuildApp => _ => _
187199 . DependsOn ( Restore )
188- . Description ( "Build and publish host application to artifacts/" )
200+ . Description ( "Build host application to artifacts/" )
189201 . Executes ( ( ) =>
190202 {
191203 var hostProjects = GetTargetHostProjects ( ) ;
@@ -199,31 +211,28 @@ private static void LogHeader(string message)
199211 continue ;
200212 }
201213
202- var outputDir = ArtifactsDirectory / hostProjectName ;
203-
204214 LogHeader ( $ "Building { hostProjectName } ") ;
205215
206- DotNetTasks . DotNetPublish ( s => s
207- . SetProject ( hostProject )
216+ // Build - OutputPath is configured in .csproj
217+ DotNetTasks . DotNetBuild ( s => s
218+ . SetProjectFile ( hostProject )
208219 . SetConfiguration ( Configuration )
209- . SetOutput ( outputDir )
210220 . EnableNoRestore ( ) ) ;
211221
212- LogSuccess ( $ "Published { hostProjectName } to { outputDir } ") ;
222+ LogSuccess ( $ "Built { hostProjectName } to { ArtifactsDirectory } ") ;
213223 }
214224 } ) ;
215225
216226 /// <summary>
217- /// Build and package modules to artifacts/{Host}/Modules/
218- /// Usage: nuke build-module [--target-host avalonia|blazor|all] [--name ModuleName]
227+ /// Build modules to artifacts/Modules/{ModuleName}/
228+ /// OutputPath is configured in each .csproj file
229+ /// Usage: nuke build-module [--name ModuleName]
219230 /// </summary>
220231 Target BuildModule => _ => _
221232 . DependsOn ( Restore )
222- . Description ( "Build and package modules to artifacts/{Host}/Modules /" )
233+ . Description ( "Build modules to artifacts/Modules/{ModuleName} /" )
223234 . Executes ( ( ) =>
224235 {
225- var hostProjects = GetTargetHostProjects ( ) ;
226-
227236 // Get module directories to build
228237 var moduleDirectories = string . IsNullOrEmpty ( PluginName )
229238 ? Directory . GetDirectories ( ModulesDirectory ) . Select ( d => ( AbsolutePath ) d ) . ToArray ( )
@@ -248,7 +257,9 @@ private static void LogHeader(string message)
248257
249258 LogHeader ( $ "Building Module: { moduleName } ") ;
250259
251- // Build all projects in this module
260+ var moduleOutputDir = ArtifactsDirectory / "Modules" / moduleName ;
261+
262+ // Build all projects - OutputPath is configured in .csproj
252263 var moduleProjects = Directory . GetFiles ( moduleDir , "*.csproj" , SearchOption . AllDirectories ) ;
253264 foreach ( var projectPath in moduleProjects )
254265 {
@@ -258,57 +269,7 @@ private static void LogHeader(string message)
258269 . EnableNoRestore ( ) ) ;
259270 }
260271
261- // Package to each target host's Modules directory
262- foreach ( var hostProjectName in hostProjects )
263- {
264- var hostType = hostProjectName . Contains ( "Avalonia" ) ? "Avalonia" : "Blazor" ;
265- var moduleOutputDir = ArtifactsDirectory / hostProjectName / "Modules" / moduleName ;
266-
267- // Clean and create output directory
268- if ( Directory . Exists ( moduleOutputDir ) )
269- Directory . Delete ( moduleOutputDir , true ) ;
270- Directory . CreateDirectory ( moduleOutputDir ) ;
271-
272- // Copy manifest.json
273- File . Copy ( manifestPath , moduleOutputDir / "manifest.json" ) ;
274-
275- // Copy DLLs from each project's output
276- foreach ( var projectPath in moduleProjects )
277- {
278- var projectDir = Path . GetDirectoryName ( projectPath ) ;
279- var projectName = Path . GetFileNameWithoutExtension ( projectPath ) ;
280-
281- // Skip UI projects that don't match the host type
282- if ( projectName . Contains ( ".UI." ) )
283- {
284- var isAvaloniaUi = projectName . Contains ( ".UI.Avalonia" ) ;
285- var isBlazorUi = projectName . Contains ( ".UI.Blazor" ) ;
286-
287- if ( isAvaloniaUi && hostType != "Avalonia" ) continue ;
288- if ( isBlazorUi && hostType != "Blazor" ) continue ;
289- }
290-
291- // Find the output directory
292- var binDir = Path . Combine ( projectDir , "bin" , Configuration . ToString ( ) ) ;
293- if ( ! Directory . Exists ( binDir ) ) continue ;
294-
295- // Find the target framework folder
296- var tfmDirs = Directory . GetDirectories ( binDir ) ;
297- var tfmDir = tfmDirs . FirstOrDefault ( d => d . Contains ( "net" ) ) ;
298- if ( tfmDir == null ) continue ;
299-
300- // Copy DLL and PDB
301- var dllPath = Path . Combine ( tfmDir , $ "{ projectName } .dll") ;
302- var pdbPath = Path . Combine ( tfmDir , $ "{ projectName } .pdb") ;
303-
304- if ( File . Exists ( dllPath ) )
305- File . Copy ( dllPath , moduleOutputDir / $ "{ projectName } .dll", true ) ;
306- if ( File . Exists ( pdbPath ) )
307- File . Copy ( pdbPath , moduleOutputDir / $ "{ projectName } .pdb", true ) ;
308- }
309-
310- LogSuccess ( $ " → { hostType } : { moduleOutputDir } ") ;
311- }
272+ LogSuccess ( $ "Built { moduleName } to { moduleOutputDir } ") ;
312273 }
313274 } ) ;
314275
0 commit comments