Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Execute the script after clicking the compile button
#1
When using the publish function in LA, the execution speed is slow, but using the compile button on the toolbar is much faster. I want to execute a specific CS script in LA after clicking the compile button. This script should add the .NET 8 runtime files to the current compilation folder. Is this possible? Or is there a better solution? Thanks in advance.
#2
My idea is to add a menu item to the context menu in LA, which, when clicked, can execute a specified CS script file.
https://i.ibb.co/JxH5gC2/C.jpg
#3
Try Properties > postBuild.
#4
thank you!
 
Quote:To create new preBuild/postBuild script: menu File > New > More.

I want to create a new preBuild/postBuild script under the currently selected script filename, but the new script always appears at the top of the file list. Is there a solution for this?
#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}");
}
#6
Quote:the new script always appears at the top of the file list

Next LA should fix it.
#7
For the code in #5,
I only want to copy the .NET 8 DLL files that are relevant to the project. My goal is to make the compiled package as small as possible. 

For example, if the project does not use WPF or WinForms components, then files like PresentationFramework.dll, System.Windows.Forms.dll, PresentationCore.dll, etc., should not be copied (as these files are also quite large).

Is this possible? How can it be achieved?
#8
robocopy has options to exclude specified files etc. But it's too difficult to detect reliably which dlls are actually used.
#9
When using the above #5 code (postBuild add .NET.cs), there are often cases where LA becomes unresponsive during execution, especially on computers using mechanical hard drives (HDD).
Is there a more efficient method?
#10
updated
#11
thank you!


Forum Jump:


Users browsing this thread: 2 Guest(s)