C# Application contain files and release them when execute - c#

My C# application(one single exe) will call C:\Program Files\7-zip\7z.exe when running, but not all computer have installed 7-zip, so is there a way that I can copy the whole 7-zip folder into my application and put it somewhere in run time then call its 7z.exe ?

Include the compression lib to your app.
The built-in compression in .NET with https://learn.microsoft.com/en-us/dotnet/standard/io/how-to-compress-and-extract-files
Or use with https://icsharpcode.github.io/SharpZipLib/

Related

Won't run .exe correctly on Windows Server

I'm trying to run a Console Application on Windows Server 2019 (x64).
After i run .exe on the server then writes the following error:
Could not load or assembly 'MySql.Data'
..etc for all dependencies.
I tried to run just the .exe file (i didn't copy the whole Release directory) on a few PC and it is working well. All of them Win 64bit.
On the server, .exe only work if i copy the whole /Release directory.
I also build and release app with 'Any Cpu' option.
Any tip why i need to copy the whole /bin/release directory to run .exe?
Why not enough just the .exe file?
Many thanks!
The exe file doesn't contain the used dlls, just references to the dlls. That's why they are in the release directory and the reason you need to copy the whole directory.
Kind regards
Bernd

Using .NET 4.5 C# to create a .exe file then write code to it in c# then open it

Hi i would like to know if i can write code into a File.Create(Directory.GetCurrentDirectory() + "/Name.exe") that is in c#.
My purpose for this is I need 2 applications, one is a launcher and one is a updater, i originaly had a File.Exist looking for the updater so no errors occured, but i would like it so you only need the launcher at first then it adds the other folders and files when you first open it.
Instead of reinventing the wheel try using ClickOnce
If you're going to need a certificate if your app is to be signed and publicly distributed. You can work with a test certificate for development
Build your app, right-click on the main project and pick Publish (also on the Build menu), follow the wizard
The target location you pick will end up having an app.application file and some folders, one for each version you publish. You can put these files on a file server somewhere and share the link to the .application file with your users. Every time you publish their app will get updated the next time they use it.
If reinventing the wheel is your thing you can build your app, make another project checks a link for a file that contains a version, compares with the local version and downloads if newer, then launches the downloaded exe.... just like clickonce

How to remotely rebuild .NET solution with C#?

i have .NET project that is a IIS Service, this is on Windows Server2008 R2 Machine.
I have another project that is C# program, that using the IIS Web service,
my question is how can i rebuild solution/project of the Webservice from C# program?
Thank you
Can you confirm that you have source files which should be compiled and then compiled project should be placed to the directory which is used by IIS web application?
If yes, I would recomment to create a powershell script. This script would perform 2 main actions:
Compile the project. Use MSBUILD.exe utility for that.
Copy compiled folder. Use ROBOCOPY utility for that.
Then just call this script from your C# code.

Difference in C# release, standalone exe or click once installation

I am using Visual Studio 2010 and I'm writing in C# (console program). I used to output a standalone .exe file from the debug folder (just copying the single .exe file to the client computers).
Now, it happens that different clients needs a different connection string. My solution was to copy the .exe file and also the .exe.config file from the debug folder. Modifying the config file will then directs the program to use different connection strings.
The concern is:
How about the other files in the debug folder, should I be copying them to the client computer as well? (e.g. .exe.manifest or .vhost files? )
Or shall I release the program into click-once file and install them into the client? But it would be quite troublesome and time consuming to install and uninstall the program on many computers (during version upgrade), also more complicated to call the program from bat files?
I used to just use the .exe file from the debug folder. But when I found out that the .exe actually reads from the .exe.config, I wonder sole use in the .exe would result in leaks in the program?

Mono shared library under linux location

I have a shared library written in C++ that I'd like to use with Mono under Linux,
I follow this guide http://www.mono-project.com/Interop_with_Native_Libraries
I got it to work, but I have to put my library file into /usr/lib or /lib folder.
Is there anyway that I could distribute and use my .so files and not copy them into /usr/lib or /lib but instead into my Mono application folder ? (current directory where the app running)
some user using the software might not have root / admin access, therefore they can't install/copy the files into /usr/lib or /lib
I think you have to use the environment variable LD_LIBRARY_PATH when launching your program:
LD_LIBRARY_PATH=. mono yourapp.exe

Categories

Resources