I have a 3rd party library which loads configuration from app.config Now I want to configure it via Azure Service Fabric Using the standard settings.xml will require a lot of work. Instead I'm hoping to simply copy the old app.config into the SF Config folder and load configuration from there.
Basically the only thing I could not figure out is how to know the path of where the Config/* contents will be while running in SF. I can get Context.CodePackageActivationContext.WorkDirectory However, then the path from that is ..\MyClass.ServicePkg.Config.1.0.0\app.config
Is there a path I can query on the Context somehow to get full path to config folder?
Yeah you can get the absolute path to your Code and Config packages, substituting the names of your packages ("Code" and "Config" are the default names in the Visual Studio project templates):
string codePackagePath = this.Context.CodePackageActivationContext.GetCodePackageObject("Code").Path;
string configPackagePath = this.Context.CodePackageActivationContext.GetConfigurationPackageObject("Config").Path;
Some background info on service packaging here.
tl;dr: Services are composed of "code" packages (your executables and DLLs) and "config" packages (any arbitrary configuration file or the built-in Settings.xml). Packages can be versioned and upgraded independently of each other. You can see this in Service Fabric Explorer under the "Details" tab of an application type (note the "Name" field - you can use any name you want and that's the name you put in GetCodePackageObject()).