App.config

This forum is meant for questions and discussions about the X# language and tools
Post Reply
boonnam
Posts: 88
Joined: Mon May 08, 2017 6:42 pm
Location: USA

App.config

Post 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.
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

App.config

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

App.config

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
boonnam
Posts: 88
Joined: Mon May 08, 2017 6:42 pm
Location: USA

App.config

Post 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
Post Reply