AWS sdk for C#, where to put the App.config file?

Question:

So I have a C# console application that uploads files to s3 storage.

It works fine when I debug it from inside Visual Studio, however, when I build the .exe and run it off my server, I get errors saying that it couldn’t find the Access Key inside the App.config file.

And also:

The second error is might be caused by the first.

I have my App.config file in the same directory as the .exe I’m running, but that doesn’t help.

What else do I have to do?

Here’s my App.config file:

The build action for this file is “Embedded Resource” I’ve also tried changing it to “Content” and that didn’t help.


Some things that may or may not be relevant:

I’m using ILMerge to merge the AWSSDK.dll (among others) into the exe, then I run that file off of an Amazon EC2 instance through the command line.

Answer:

When you look in your “bin” directory, the .config file should be named yourprogram.exe.config. It won’t find the configuration values otherwise, and it should be a content file, not an embedded resource. The .config file must always be present and in the same directory as the EXE.

Leave a Reply