t_plusplus
t_plusplus

Reputation: 4209

ILMerge: Combining assemblies in one exe, App.Config

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.

Upvotes: 1

Views: 3419

Answers (2)

Matt Pedigo
Matt Pedigo

Reputation: 145

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

Upvotes: 1

eladcon
eladcon

Reputation: 5825

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.

Upvotes: 4

Related Questions