Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Execute the script after clicking the compile button
#5
Code:
Copy      Help
// script "exeWithNet.cs"
/*/ role exeProgram; postBuild postBuild add .NET.cs; outputPath %folders.Workspace%\exe\exeWithNet; /*/
dialog.show("folders.NetRuntime", folders.NetRuntime);
 
Code:
Copy      Help
// 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}");
}


Messages In This Thread
RE: Executing PowerShell code at the API level - by Gintaras - 08-06-2024, 09:34 AM

Forum Jump:


Users browsing this thread: 19 Guest(s)