Comments (11)
it’s both, you merge into a dll or an exe
from il-repack.
Thanks for the reply. Am I possibly doing something wrong then?
ILRepack.exe /out:"H:\Projects\demo\bin\Release\net481\publish\demoproject.exe" /lib:"H:\Projects\demo\bin\Release\net481\publish" /out:"H:\CSharpProjects\demo\bin\Release\net481\publish\demoproject.exe" "H:\Projects\demo\bin\Release\net481\publish\System.Management.Automation.dll"
Using absolute paths is what got me results, but all I was attempting to test was integrating the Powershell automation DLL into my exe. However, after the process completes, you can't launch the exe. It actually says that the program cannot be ran by windows, almost as if it's corrupted.
The overall project has 4 DLLs, but I've just been trying to do one for now just to test with and confirm that I can still access those features within the exe after the merge is complete.
I do get an affirmative back from ILRepack
Wrote H:\Projects\demo\bin\Release\net481\publish\demoproject.exe
from il-repack.
your /out is specified twice
from il-repack.
Sorry, bad copy/paste from terminal. Yeah it only had one /out
, just checked.
The size increases, but the file becomes corrupted.
ILRepack.exe /out:"H:\Projects\demo\bin\Release\net481\publish\demoproject.exe" /lib:"H:\Projects\demo\bin\Release\net481\publish" "H:\Projects\demo\Release\net481\publish\System.Management.Automation.dll"
Is the actual command that was ran.
Actually tried another DLL, and that time, the size of the exe dramatically went down from 200kb to 11kb. The DLL was 21KB
from il-repack.
oh, indeed, you can’t merge with a .NET apphost exe, it’s not a managed assembly. Merge with demoproject.dll, not demoproject.exe.
We should report an error when we detect this case.
from il-repack.
look into PublishSingleFile perhaps
from il-repack.
Thanks, I'll take a look.
I keep on .net 4.8.1 because most people have a lot of those libraries, including Powershell (the automation DLL), but I tried net8, and that powershell DLL is roughly 8MB. So I'd have to ship an 8MB file along with a 200kb exe, which just seems really odd.
I'll see what I can do with publish single file and try to play with this more.
from il-repack.
Just an update.
I spent 5 or so hours messing with all of this.
I was able to successfully do exactly what I wanted with the older ILMerge. The only thing of note was that the DLLs had to be merged in a certain order otherwise a series of random errors would occur, even stack exceptions.
But after running the exe on a brand new system, all the features work.
I now need to see if I can take that same process and try it with ILRepack. But I was able to do it with ILMerge just fine by building the exe and then utilizing the command-line.
I could have used SingleFilePublish on NET 8, however, that version requires more DLLs to be integrated with my program, including an 8MB Powershell DLL for me to run powershell commands. Whereas with .net 4.8.1, that automation DLL is provided with all fresh installs of Windows and is not a dependency that needs to be messed with.
So the only option to make this is the easiest, was to stick with 4.8.1, and then get ILMerge / ILRepack to integrate the libraries I did actually need.
from il-repack.
Keeping the issue open to issue an error when we attempt to merge a native exe/dll.
Would you mind pasting the exact command line you ended up using with ILMerge? I'm still curious if there's an actual bug in ILRepack here (other than you can't merge the apphost exe).
from il-repack.
Sure thing. To make it easier, I just created a batch file to run the build
SET ILMERGE_VERSION=3.0.41
SET PATH_ILMERGE=%USERPROFILE%\.nuget\packages\ilmerge\%ILMERGE_VERSION%\tools\net452
"%PATH_ILMERGE%"\ILMerge.exe bin\Publish\demoapp.exe ^
/lib:bin\Publish ^
/out:bin\Publish\demoapp.exe ^
System.Buffers.dll ^
System.Numerics.Vectors.dll ^
System.Memory.dll
Was relatively straight forward with ILMerge. I haven't had a lot of time lately, but I do want to go back and try again with li repack. I'd rather use the updated program and not rely on the old version.
But as long as I combine the DLLs in this order, everything works perfect.
Ran the exe on my main desktop, and also in a virtual machine to make sure everything was included, and both machines worked great with the single exe.
from il-repack.
Let me know if you still see issues. If there are still problems I'll need a detailed repro and the logs (/verbose /log:log.txt
)
from il-repack.
Related Issues (20)
- ContinuousIntegrationBuild
- Issue with 2.0.22: Failed to resolve assembly 'Microsoft.Build.Framework' HOT 7
- Properly document all new command line options
- Proposal: Rename /ExcludeInternalizeSerializable to /InternalizeSerializable HOT 1
- Better support for dropping attributes HOT 5
- Add developmentDependency to the nuspec HOT 2
- Error merging VB app in 2.0.27 HOT 20
- Mysterious failure in ILpacked application HOT 10
- Exceptions aren't renamed? HOT 3
- ILRepacked DLL is looking for PDB files in a non-existent subfolder HOT 5
- Ability to internalize a subset of input assemblies HOT 1
- Add an Icon to the nuget package HOT 1
- Repacking Harmony in Debug mode fails HOT 15
- Disable source server warning on unix HOT 2
- Possible Internalize regression HOT 5
- Cecil binaries need to be internalized HOT 7
- Getting "Method reference is used with definition return type / parameter." / Due to TypeForwardedTo type HOT 22
- Replacement for AllowDuplicateType Method of ILMerge HOT 3
- ArgumentOutOfRange in RepackAssemblyResolver.cs:line 203 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from il-repack.