开发者

VB.Net Application Settings / ClickOnce

VS 2008 / VB.Net / WinForms

I have an application setting (Settings.settings) for a project and I am using Click Once deployment.

I used the VS Editor to create the setting and I can see the setting in the app.config file

<applicationSettings>
  <MyApp.Win.My.MySettings>
   <setting name="MySetting" serializeAs="String">
    <value>False</value>
   </setting>
  </MyApp.Win.My.MySettings>
 </applicationSettings>

I would like to update this setting after the application is packaged in click once. The setting is for testing purposes only.

If I change the xxx.config.deploy and I reinstall the app with click once. The new setting value doesn't chan开发者_开发问答ge (seems to be cached somewhere). Even if I change in my local pc the setting seems to be cached somewhere. If I go in VS it asks me to Re-Sync the settings. But I need to do this after the application is packaged in click once.

Update

I am able to change other settings for example the connection string and it is reflected after an application is installed. I only have issues with the "MySettings" settings.

Clarifying steps:

  1. Create click once deployment
  2. Copy to customers' deployment server (IIS)
  3. Edit the xxx.config.deploy file on the server
  4. Install on a client PC (By installing from deployment server on step 2)
  5. The client PC doesn't have the updated setting

Thanks for any help


Interesting. I would have thought the install would have failed but I just tried it, changed a value in the config.deploy and the install works fine and as you say the value I changed still has the original value.

When the deploy files are created clickonce creates a manifest and does a check to ensure that every file is unchanged, if any file is different the install fails.

Seems that the config.deploy is not checked so I'd GUESS that when the manifest is created it must record the contents and use those contents when client installs.

So how to update your value? The problem is that the creation of the manifests occurs during the CoreBuild target of MsBuild. Any change after that will invalidate the pubished build, therefore I think the best place to update it is in the BeforeBuild event. There are a number of things to consider when updating the file so check my blog entry, it's a bit of overkill for what you want to do but even though what you want to do seems simple, it's quite tricky to get right.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜