Posts: 1,031
Threads: 246
Joined: Jul 2022
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.
Posts: 1,031
Threads: 246
Joined: Jul 2022
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
Posts: 12,071
Threads: 140
Joined: Dec 2002
Try Properties > postBuild.
Posts: 1,031
Threads: 246
Joined: Jul 2022
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?
Posts: 12,071
Threads: 140
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}");
}
Posts: 12,071
Threads: 140
Joined: Dec 2002
Quote:the new script always appears at the top of the file list
Next LA should fix it.
Posts: 1,031
Threads: 246
Joined: Jul 2022
08-07-2024, 12:10 AM
(This post was last modified: 08-07-2024, 12:13 AM by Davider.)
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?
Posts: 12,071
Threads: 140
Joined: Dec 2002
robocopy has options to exclude specified files etc. But it's too difficult to detect reliably which dlls are actually used.
Posts: 1,031
Threads: 246
Joined: Jul 2022
08-07-2024, 09:54 PM
(This post was last modified: 08-08-2024, 12:18 AM by Davider.)
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?
Posts: 12,071
Threads: 140
Joined: Dec 2002
08-08-2024, 04:33 AM
(This post was last modified: 08-08-2024, 12:34 PM by Gintaras.)
updated
Posts: 1,031
Threads: 246
Joined: Jul 2022