Search code examples
c#ilmerge

ILMerge assembly with spaces


I'm trying to use ILMerge to create a single executable to distribute and I'm having some difficulty because my application has spaces in the filename. It appears that ILMerge uses a space a delimiter to specify multiple input assemblies. This means there are assemblies that it can't find (because they don't exist obviously) but I'm been unable to find any combination of quotes and double-quotes to tell ILMerge to ignore the spaces.

Command Line Input:

/out:bin\Debug\My Application.exe /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5" "obj\Debug\My Application.exe" "C:\Users\Username\source\repos\CompanyInternal\My Application\My Application\Newtonsoft.Json.dll" "C:\Users\Username\source\repos\CompanyInternal\My Application\My Application\Renci.SshNet.dll" /log"

Command Line Output:

The list of input assemblies is:
    My
    Application.exe
    obj\Debug\My Application.exe
    C:\Users\Username\source\repos\CompanyInternal\My Application\My Application\Newtonsoft.Json.dll
    C:\Users\Username\source\repos\CompanyInternal\My Application\My Application\Renci.SshNet.dll
Could not find the file 'My'.
An exception occurred during merging:
ILMerge.Merge: Could not find the file 'My'.
   at ILMerging.ILMerge.Merge()
   at ILMerging.ILMerge.Main(String[] args)

Any help anybody can provide would be greatly appreciated.


Solution

  • have you tried quoting it like the rest of the command line parameters with spaces?

    i.e.: /out:"bin\Debug\My Application.exe" /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5" "obj\Debug\My Application.exe" "C:\Users\Username\source\repos\CompanyInternal\My Application\My Application\Newtonsoft.Json.dll" "C:\Users\Username\source\repos\CompanyInternal\My Application\My Application\Renci.SshNet.dll" /log"