Posts: 12,140
Threads: 142
Joined: Dec 2002
08-06-2024, 09:34 AM
(This post was last modified: 08-08-2024, 12:33 PM by Gintaras.)
// script "exeWithNet.cs"
/*/ role exeProgram; postBuild postBuild add .NET.cs; outputPath %folders.Workspace%\exe\exeWithNet; /*/
dialog.show("folders.NetRuntime", folders.NetRuntime);
// script "postBuild add .NET.cs"
/*/ role editorExtension; /*/
var c = PrePostBuild.Info;
//print.it(c);
if (c.role != "exeProgram") throw new InvalidOperationException("Expected role exeProgram");
if (!c.publish) {
run.thread(() => {
try {
_Copy(folders.NetRuntime);
if (folders.NetRuntimeDesktop != folders.NetRuntime) _Copy(folders.NetRuntimeDesktop);
print.it("Copied .NET Runtime -> " + c.outputPath);
}
catch (Exception ex) { print.it(ex); }
});
}
void _Copy(string from) {
int r = run.console(out var so, "robocopy.exe", $"""
"{from}" "{c.outputPath}" /e /xj /r:0 /w:1 /np /mt
""");
if ((uint)r >= 8) throw new AuException($"Failed to copy. {so}");
}