In a .NET Core project, I want to copy some dll's after the project has compiled. I have successfully done that with a simple xcopy operation setup in the scripts -> postcompile section of the project.json file.
I want this copy-operation to be cross-platform, so xcopy is not an option (for Mac/Linux at least). Is there a way to copy the files that works cross platform, or some way to detect the platform so I can branch out and call a cmd script when on Windows and a shell script when on Mac/Linux?
Assuming you are using the project.json build system, this can be done by referencing a script file without the file extension in the "scripts" section.
"scripts": {
"postcompile": "copy-assets"
}
To support cross-plat, you need two script files in the same folder as project.json, copy-assets.cmd and copy-assets.sh. Make sure to chmod +x your .sh file to it can be executed.
Related
I have an electron app that I want my users to be able to install. However, a dependency of this app is a C++ package that I have compressed in a .zip file. I need the user to unzip this file and put it into a certain directory under Program Files (target platform is windows). Is it possible to create an installer that both installs the electron app and contains a payload that it can unzip and put into that directory?
Yes, this is possible. An Electron app is just a bunch of files that you can package however you want. A great tool for packaging Electron apps is electron-builder
electron-builder uses NSIS by default to build Windows setups. It also provides a way to customize the NSIS script
If you want to include additional resources for use during installation, such as scripts or additional installers, you can place them in the build directory and include them with File. For example, to include and run extramsi.msi during installation, place it in the build directory and use the following:
!macro customInstall
File /oname=$PLUGINSDIR\extramsi.msi "${BUILD_RESOURCES_DIR}\extramsi.msi"
ExecWait '"msiexec" /i "$PLUGINSDIR\extramsi.msi" /passive'
!macroend
In your case, instead of extramsi.msi, you'll probably want to include 7zip standalone console version and your additional .zip file. You can use this custom script to extract this file to wherever you want
I am building an installer using InstallForge.
Along with my install, i need to run some Third Party installers, for example, Cuda 9.1.
What I want is to create an installer, and a folder structure like this:
Installer.exe
InstallsDir
-Cuda.exe
-ThirdpartyInstall.exe
Then when my installer runs, it should also run the other two exe files.
In the setup process for InstallForge, it allows you to run commands, which i can use to run the exe files.
There is a command variable: <installpath>\ that is used to run a file from the path that my programme is installed to.
My question is, is there a similar command that i can use to run a file in the directory that the installer runs from?
How can i set a relative link to the current directory using InstallForge setup?
Problem
I see all these plugins from MobaXTerm, but I don't know how to make my own. I see no links to any tutorials or whatever. Is there even a way to do it?
What I really want (XY problem)
I want to create my own commands. I want these to be available on each server I go to and I don't want to add each of these to my bin and .bash_profile etc. I think plugin is the way to go.
Even more background
I am not that good in shell programming, but I can program java. I created a jar which handles my commands. So I have created my own linux script on my local environment to test all these things. They work, but I dont want to 'export' them to other servers. Seems like a bad idea to do.
MobaXterm plugins are just Windows or Cygwin executables packaged in a .mxt3 file which is just a standard ZIP archive with a specific structure.
Read this from the MobaXterm FAQ:
I would like to create a new plugin for MobaXterm. How can I do that?
Download an existing plugin file (for instance "Midnight commander")
Rename plugin extension from ".mxt3" to ".zip"
Open the ".zip" file You will notice that creating MobaXterm plugins only consists in putting the required commands (executables, libraries
and configuration files) into a ZIP file, keeping the same folders
tree than in MobaXterm ("/bin", "/lib", "/usr", "/etc").
If you want to add a simple Windows program (exe file), you will just have to copy the executable file into the "/bin" directory,
create the ZIP archive, rename it to ".mxt3" and put it in the same
directory than MobaXterm executable.
If you want to add a Linux program, you will have to get it from the Cygwin project or to recompile it using make, gcc, g++ or other
compilers that are available from the MobaXterm "Development" plugin.
Remember MobaXterm's terminal is just Cygwin, so you may be able to cross compile some packages within Moba by simply installing the necessary compiler tools.
How can I include an SO file when I build for linux? With windows I simply put the dll in the same folder but that did not work with the linux build. In particular, I am building a go sciter project and need to include the libsciter-gtk-64.so in the executable/package.
My way of solving this was to use an additional tool, which had the added benefit of an optional desktop file and other metadata. AppImage solves the library problem, all I had to do was create an AppImage with the so files in /usr/lib/ and build through their command.
#Robert's solution is nice. One could also place the *.so file in the same directory as the executable and create a start.sh script with the line:
LD_LIBRARY_PATH="$(dirname "$0")" "$(dirname "$0")/your_executable"
In our web project, we've modified the .csproj file to run this command pre-build:
cd $(MSBuildProjectDirectory)
npm run build-release
cd $(MSBuildStartupDirectory)
It works just fine.
The problem is that we don't want this in the .csproj anymore. We only want it in the build definition.
I can't figure out. This is what I have, and I get errors about the path being too long.
It's a pre-build script. You can run batch files or PowerShell scripts, not command line utilities. The script should be a source controlled artifact, and the path to the script file should be a source control location, not a local path on the build agent.