1

I am using ILMerge to combine .ddls in one executable, however when I run the Output.exe, it seems not to be finding the App.Config file. It is returning an error of: InvalidOperationException: No connection string name could be found in application config file.

I wonder whether ILMerge has included the App.Config file in the Output.exe at all.

How can I not include it and make sure that the Output.exe is referencing it?

I used the ILMerge GUI - this doesn't give me the option to include anything but the .dlls - which I select from the bin/Release folder where the ConsoleApplication compiles into.

Here is an image from the bin/Debug folder. ILMerge doesn't give me the option to include ConsoleLayer.vshost.exe.config - which includes the (basically) App.Config file. How can I make it include it so that the Output.exe knows the connection string details when it runs?

enter image description here

Thanks.

t_plusplus
  • 4,079
  • 5
  • 45
  • 60

2 Answers2

4

The default configuration file is app_name.exe.config. You need to take the config file you want and rename it to match the exe file. In your case Output.exe.config.

eladcon
  • 5,815
  • 1
  • 16
  • 19
  • do you mean to copy the ConsoleLayer.vshost.exe.config file (the one with a red line near it - above) to the directory where Output.exe.config and rename it? Or do you mean take it from the Project itself in visual studio? What about the App.Config for the Assembly which holds the DataLayer (EntityFramework) do I need to copy it too and under what name? – t_plusplus Feb 19 '15 at 15:30
  • assuming your app can run by executing `ConsoleLayer.exe`, you can copy `ConsoleLayer.exe.config`(which is the config file your app uses), and rename it to `Output.exe.config`. – eladcon Feb 19 '15 at 15:39
  • Thanks, this changed the above error, to a new one - which is a progress. It now complains that it cannot load file or assembly 'Entity Framework'. Could this be something to do with Packages.config? I tried to copy it and rename it to packages.exe.config but this didn't help. Any idea, I wonder? – t_plusplus Feb 19 '15 at 15:45
1

This may be a bit late for this if you have found a solution, but any file with vshost in it's name is generally associated with debug mode in your application. It's you application running in debug mode. So when you are clicking on the application.exe to run you app, it does not look for any file with vshost in the file name. it looks for the application.exe.config instead. You can turn this off for debugging.

Unless you are planning on including your debug files in you merged exe, I see no need to include it. it's only useful in debugging.

Here are some links that may be helpful...

google search for disabling vshost

Stackoverflow question and answer...

what-is-the-purpose-of-vshost-exe-file answered by the famous Jon Skeet

Community
  • 1
  • 1
Matt Pedigo
  • 145
  • 1
  • 1
  • 11