0

first i want to explain my enviroment.

I have a Service.exe (it's a service) and this is one project in a special folder. And i have a Configurator.exe (wpf app) and this is another project in a different folder. The Configurator.exe needs the content of Service.Properties.

My solutions i tried: In Configurator:

using Service.Properties;
string var1 = Settings.Default.var1;

That works BUT when i use this way, the whole Service project is imported into the configurator project (in the bin). That is not allowed to happen in my case and it has to be separated.

What else i can do? The there is also a xml setting file. I can parse and load the data. But it's not so elegant, like using directly the Properties.

I want to know, if it is possible to use the Properties of another project, without importing the project. Somehow it should be possible to make a reference or import only the class and not the whole project.

But i dont know how :/

Can someone maybe give me a hint? :)

nninja
  • 41
  • 1
  • 5
  • I have something very similar to this in one of my projects. All I did was right click on my properties in (your case) Configurator and click "Add -> Existing Item" and added the Settings file from (in your case) Service to it. **Note:** I did this with a plain .cs file (SolutionInfo.cs) and it worked. Might not work in your case hence the comment – MindSwipe Jan 25 '19 at 12:06
  • @MindSwipe Thank you for the comment but I guess this wont work. The settings.cs is saved somewhere - the folder can change depending on system. (https://stackoverflow.com/questions/982354/where-are-the-properties-settings-default-stored) And i'm not sure if the settings.cs contains all the fields and data. It has to be some relative path, also. But i search for it and try it out. – nninja Jan 25 '19 at 12:30
  • Another way of solving it would be to have a settings.txt/ settings.json/ settings.xml (or any other file) and save that somewhere you know on the Machine (e.g `C:\\MyApp\settings.txt`) and detect changes in it from you service and read/ write changes to it from your Configurator – MindSwipe Jan 25 '19 at 12:43
  • If it's inside the Solution folder for the service project don't use it, because this file gets "compiled" alongside the C# code and will be inside the service.exe (.exe and .dll are kinda like .zip files containing everything from the project within them). Instead create a new file somewhere and have your Service watch the directory and filter for a known name and read it every time it changes – MindSwipe Jan 25 '19 at 12:59

0 Answers0