File tree Expand file tree Collapse file tree 1 file changed +24
-10
lines changed
Expand file tree Collapse file tree 1 file changed +24
-10
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,31 @@ if not exist "%destinationDirectory%" (
1313 exit /b 1
1414)
1515
16- rem Loop through all files in the source directory
17- for %%F in (" %sourceDirectory% \*.*" ) do (
18- rem Check if the file exists in the destination directory
19- if exist " %destinationDirectory% \%%~nxF " (
20- rem Replace the file in the destination directory
21- copy /y " %%F " " %destinationDirectory% "
22- echo %%~nxF replaced.
23- ) else (
24- echo %%~nxF does not exist in the destination directory.
16+ rem Ensure the source directory exists
17+ if not exist " %sourceDirectory% " (
18+ echo Source directory does not exist.
19+ exit /b 1
20+ )
21+
22+ rem Only process redistributable payloads (ignore nuspec/readme/license)
23+ set " missingCount = 0"
24+ for %%F in (" %destinationDirectory% \*.dll" " %destinationDirectory% \*.xml" ) do (
25+ if not exist " %sourceDirectory% \%%~nxF " (
26+ echo Missing in managed directory: %%~nxF
27+ set /a missingCount += 1
2528 )
2629)
2730
31+ if !missingCount! gtr 0 (
32+ echo Found !missingCount! missing file(s) in the managed directory. Aborting.
33+ exit /b 1
34+ )
35+
36+ rem Second pass: copy files now that all exist
37+ for %%F in (" %destinationDirectory% \*.dll" " %destinationDirectory% \*.xml" ) do (
38+ copy /y " %sourceDirectory% \%%~nxF " " %destinationDirectory% " > nul
39+ echo %%~nxF replaced.
40+ )
41+
2842echo Replacement completed.
29- exit /b 0
43+ exit /b 0
You can’t perform that action at this time.
0 commit comments