xsharp.eu • App.config
Page 1 of 1

App.config

Posted: Mon May 22, 2017 10:02 pm
by boonnam
A quick question regarding X# and WPF. Does X# uses App.config?

A background on why I asked that question. Since "Ado.NET Entity Data Model" isn't available for X#, I decided to create a class library for Entity Framework in C#. In order to consume my dll, I must set the connectionString in App.config. During a build I get an error, XS1936. The location of the error tell me I am missing the connectionString in App.config. I ran into similar issue in C#, but once I updated my App.config, it works.

App.config

Posted: Tue May 23, 2017 4:04 am
by wriedmann
Hi,

the use of the App.config is a runtime story. I don't know of the project system of X# supports it, but if class libraries you use make use also of the App.config, it is required.

It is possible to "live" also without App.config, and sometimes it is required, specially when you are using the functionality in a DLL and not in the executable itself (I had this issue with the Google AdWords library and it was a bit of research and work).

Wolfgang

App.config

Posted: Tue May 23, 2017 7:03 am
by robert
Hi,

App.config is fully supported by X#. You can manually add an app.config or use the Settings tab page of the Project Properties. That tab page will create a Settings class and will also create and maintain the App.config.
In the settings editor you can choose whether you want an internal settings class or a public settings class (combo box on the toolbar).
If you open the Settings tab for a project that already has a app.config then the page will
be filled with the existing entries from app.config.

Also during the build process the app.config will be copied to the output folder as myapp.exe.config


Robert

App.config

Posted: Tue May 23, 2017 4:43 pm
by boonnam
Thank you, Robert and Wolfgang for the quick reply. It turn out I was missing "using System.Linq". I gotten so used to that line automatically being inserted when I create WPF and Winform under C#, but for X# that is not the case, but it is automatically inserted for X# console application. Sorry for the confusion.

Boonnam