How to use ilMerge to merge dll into an exe file? [duplicate] - dll

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Merging .dll with .exe
Okay, so... I have all the files of ilmerge, along with the .exe (CabalMain.exe) and the dll (crckd.dll) in one path. C:\Program Files (x86)\Microsoft\ILMerge
I shift>rightclick folder and open up command prompt.
Since I'd like to merge the two I enter:
C:\Program Files (x86)\Microsoft\ILMerge>C:\Program Files (x86)\Microsoft\ILMerg
e\ilmerge C:\Program Files (x86)\Microsoft\ILMerge\Cabalmain.exe C:\Program File
s (x86)\Microsoft\ILMerge\crckd.dll /out:C:\Program Files (x86)\Microsoft\ILMerg
e
(I believe that is the correct process to merge)
And I received
C:\Program Files (x86)\Microsoft\ILMerge>C:\Program Files (x86)\Microsoft\ILMerg
e\ilmerge C:\Program Files (x86)\Microsoft\ILMerge\Cabalmain.exe C:\Program File
s (x86)\Microsoft\ILMerge\crckd.dll /out:C:\Program Files (x86)\Microsoft\ILMerg
e
Simple instructions would be appreciated.

As you have now copied every thing in the programs folder of ilmerge (which is not wise and was adviced against in the duplicate question) the correct command (from the ilmerge folder) should be:
ilmerge cabalmain.exe crckd.dll /out:%userprofile%\cabalmainmerged.exe
If no errors are shown you can type start %userprofile% and in the explorer window that opens you should find cabalmainmerged.exe
'Could not load assembly ' means that the exe or dll files that you try to merge are not copied to the correct folder. If one of the exe or dll's depend on other assemblys they all have to be in the same folder.
Wiser is to have a folder c:\merge and copy all relevant files in that folder. Then start a commandprompt and
c:
cd\merge
then
"C:\Program Files (x86)\Microsoft\ILMerge\ilmerge" "yourexe.exe" "your1stdll.dll" /out:mergedexe.exe

Related

FileExplorer not showing folder for VBE7.dll that does exist (Yes...Hidden folders are being shown)

I am curious to modify the .dll file for VBA based on these suggestions to get a custom color scheme.
When I inspect references in the VBA Editor I see a reference to
C:\Program Files\Common Files\Microsoft Shared\VBA\VBA7.1\VBE7.dll
Problem:
Using File Explorer or Chrome, it appears the VBA folder does not exist. There is no VBA folder at
C:\Program Files\Common Files\Microsoft Shared
Image showing VBA folder does not exist
In my File Explorer options I have configured to show hidden and protected folders. I believe it should be showing based on my settings.
My File Explorer Settings 1/2
My File Explorer Settings 2/2
How can I find the file at my destination, in order to backup and modify it? Since VBA does work on my machine, I am confident it does exist.
If you have 32 bit office it would not be there but at C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA7.1\VBE7.dll.
I'm using Office 2019 (Microsoft® Excel® for Microsoft 365 MSO (16.0.14326.20850) 32-bit
After running an extensive search for that dll on my entire PC, I found it here:
c:\Program Files (x86)\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA7.1\

The following code it does delete C:\ path?

Dim path As String = "C:\Program Files\MyApplication\"
System.IO.Directory.Delete(path, True)
Is this going to delete the C:\ folder?
I want to make an uninstall logic, and I want to delete all files from the C:\Program Files\MyApplication\ folder.
Does deleting a folder that I want delete the whole C:\ path?
Sorry for this question but I am beginner in VB.NET
The logic you wrote will indeed delete directory C:\Program Files\MyApplication\ and all folders and files inside it.
It will not delete any other files or the C: drive.

Visual Studio ASP.NET Web API Precompiled files placed in a different folder with TFS

I have an asp.net web api project whose output needs to be packaged in a setup project using wix.
I would like to precompile the site. The problem is that the precompilation process generates variable file names (ie. *.compiled files in particular).
I also would like to build the setup in a TFS build.
It seems that my only option is to generate a .wxs file wihtin the prebuild step of the wix project.
The .wxs files source paths are using $(var._My_Web_Project_.TargetDir). This seems to be translated to a Sources based directory.
I'm using paraffin to do that already and it works perfectly fine when building the solution with visual studio.
When building the solution through a TFS build, the .compiled files are copied to a Binaries folder, whereas all the other related web site files are copied to a Sources based directory.
The build errors are like the following :
The system cannot find the file 'd:\BuildAgents\___basedir___\Binaries\___web_project_dir\_PublishedWebSites\___site___\bin\textsample.cshtml.c6fb271c.compiled'.
The file is indeed in the Sources directory.
'd:\BuildAgents\___basedir___\Sources\___web_project_dir\_PublishedWebSites\___site___\bin\textsample.cshtml.c6fb271c.compiled'
I think I somehow need to redefine the aspnet_compiler output or something like this, but can't figure out how to do that.
The msbuild command line arguments are the follwing:
/p:GenerateProjectSpecificOutputFolder=true /p:VisualStudioVersion=14.0 /p:DeployOnBuild=true /p:PublishProfile=local /p:CleanWebProjectOutputDir=False /verbosity:d
EDIT 1: I'm using XAML build.
Any help appreciated.
EDIT 2:
With the new task based build, it works as is (no need to use an additional Copy Files task).
The aspnet_compiler output the .compiled files in the correct folder :
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p D:\BuildAgents\vNext\_work\1\s\Softs\__Solution__\__Web_Project\obj\Release\AspnetCompileMerge\Source -c D:\BuildAgents\vNext\_work\1\s\Softs\__Solution__\__Web_Project__\obj\Release\AspnetCompileMerge\TempBuildDir
In the new tasks based build system, it's easy to copy files from a source folder to a target folder with Copy Files task.
Source Folder: Folder that contains the files you want to copy.
Contents: Specify minimatch pattern filters (one on each line) that you want to apply to the list of files to be copied.
Target Folder: Folder where the files will be copied. In most cases you specify this folder using a variable.

Adding a folder with files to application - Visual Basic 2010

In my current project I have a folder with several files that the application needs to function properly. The folder is in the bin/debug folder and with the line Application.StartupPath I can easily access the files. It couldn't be easier.
However, when I publish the application the files don't seem to be included in the project, at least not at the StartupPath.
So my question is: how am I supposed to add this folder to my published application?
First, you'll need to include those files in your project. Then click each file in the Solution Explorer and in the Properties Windows change the value for "Copy to Output Directory" to "Copy Always".

How to copy dll config files into bin folder while publish in Visual Studio 2013?

I am working on a web application that use some external dll with config files, such as Lib1.dll, Lib1.dll.config, etc. Basically these files are manually copied into bin folder and only got loaded at run-time.
I tried to add those dll as reference and am able to copy these dll files into bin folder, but how can I deal with those config files? Is there a way I can include these config files in solution and force them copy to bin folder when using Visual Studio publish?
Please help, Thank you.
You can include the files into the project in Visual Studio, and change the file property "copy to output directory" (in "Properties Window") to "always" or "copy if new".