質問

We're developing a Line-of-business Windows Store App (8.1) that we're deploying via the sideloading process - but we need to include a "system wide" setting (in this case, the address of the database server as a URI)

We don't want to have the end users setting this through the app (as this would need to be in the user-specific local or roaming settings) - ideally we'd want to set this up as the application is deployed to the machine, as different installations of the product will need different database strings.

In the Windows-Forms world, we'd use an app.config in the application's program files folder, but as far as I can see from MSDN there's no equivalent of this in the sandbox of the Windows Store as the apps are installed into a structure under the \Users\[username] folder structure

We've though of a few things which are all a bit clunky...

  • hard coding the address and doing a new build for each customer deployment
  • hard coding an address and using a DNS remapping to point to the real server name (can't cope if we need to change the port number)
  • allowing end users access to the setting through the settings charm and storing it per-user

Has anyone else solved this problem and come up with a way of either setting this during deployment, or via another mechanism to get the setting into each users sandbox'd install of the Windows 8 app.

役に立ちましたか?

解決

Trying to figure out such a scenario myself. I think I will not use the branching approach but a customer build using msbuild. You run msbuild with /p:customer=customer1 and have in your project file an

<ItemGroup Include='%(customer).config'> <Link>app.config</Link> </ItemGroup> Then in your app you have a app.config file included that contains the content of each customers config. If you have a new customer you just add another newcustomer.config file and build the app with msbuild projecfile /p:customer=newcustomer or have a clever batch msbuild that finds all *.config files and builds the projects for them.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top