|
I am using 3.5 sp1 and I have deployed the XBAP in an Intranet with no signed manifest or hashed application files.
Unless I clear the click-once cache with mage -cc the XBAP does not re-read the setting in the app.config file. How can I get the XBAP to notice and re-read the app.config file when it's changed on the server?
|
| Chris Pope Wednesday, April 29, 2009 7:22 PM |
OK I got your recipe to work, here's precisely what I did. Hope this helps...
1) Create un-signed and un-hashed xbap ...
2) Publish this once...
3) Made the following modifications: (note that <Different fromexisting version> must always be the same for you per instance)
In your exe.manifest <asmv1:assemblyIdentity version="<Different fromexisting version>" name="YourXbap.exe" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" /> AND: <file name="YourXbap.exe.config" size="972" /> <-- Needs to match size of modified .config file, and ideally it should change every time.
And In your xbap: <assemblyIdentity name="YourXbap.xbap" version="<Different fromexisting version>" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
<assemblyIdentity name="YourXbap.exe" version="<Different fromexisting version>" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
For me, the tricky part was that I had to modify the version in 3 unique places for it to redownload the whole app, then I got that working and wasn't getting the .config file downloaded as I needed the entry for the size of the file to update too.
Please let me know if this works for you!
-Matt
SDET : Deployment/Hosting- Marked As Answer byLinda LiuMSFT, ModeratorWednesday, May 27, 2009 3:20 AM
-
|
| Matt Galbraith - MSFT Wednesday, May 20, 2009 2:02 AM |
Hi Chris,
You have mentioned the app.config file is on a server. Is the XBAP installed via ClickOnce on that server as well?
How you change the data in the app.config file? Doesn't you modify the data from the ClickOnce application? If so, the ClickOnce application should see the latest value in the app.config file.
Sincerely, Linda Liu Please remember to mark the replies as answers if they help and unmark them if they provide no help.
end us any feedback you have about the help from MSFT at fbmsdn@microsoft.com. |
| Linda Liu Thursday, April 30, 2009 9:21 AM |
The deployment files (.deploy, .manifest, .xbap) for the XBAP are on an internal server. I placed these files there manually after building the project using msbuild /target:Publish. I do not know how to install them on the server with ClickOnce. The application will not 'run' on the server, they are just there so the end user can connect to a URL served from IIS and deploy the XBAP on their local machine.
I modify the .exe.config.deploy file with the intention to have the XBAP notice the change. I watched the network with Fiddler and noticed that the XBAP never attempts to see if the config file has changed when the XBAP runs. |
| Chris Pope Saturday, May 02, 2009 6:44 PM |
Hi Chris,
Thank you for your reply!
I am still not veryclear about your scenario.
> I do not know how to install them on the server with ClickOnce.
After you publish the application via ClickOnce, launch the .application filefrom the client machine and this will install the application on that client machine.
> I watched the network with Fiddler and noticed that the XBAP never attempts to see if the config file has changed when the XBAP runs.
Itbehavior isby design. Youcancall the ApplicationSettingsBase.Reload method to refresh the application settings property values from persistent storage. For example:
Properties.Settings.Default.Reload(); string newvalue = Properties.Settings.Default.Setting1;
Hope this helps. If you have any question, please feel free to let me know.
Sincerely, Linda Liu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
end us any feedback you have about the help from MSFT at fbmsdn@microsoft.com. |
| Linda Liu Tuesday, May 05, 2009 7:49 AM |
Thank you for replying.
What is unclear about my scenario?
To answer the first point in your post, You asked " Is the XBAP installed via ClickOnce on that server as well? "
Is there a reason it needs to be installed on the server?
To answer your second point about using ApplicationSettingsBase.Reload, I cannot use that syntax because the Reload method this is not a static method of ApplicationSettingsBase, it is an instance method. How do I get an instance of ApplicationSettingsBase?
|
| Chris Pope Tuesday, May 05, 2009 7:48 PM |
Jumping in a little late. Are you still having trouble with this? When you updated the config file did you also update the deployment version of the XBAP package. You need to update this publish version so that ClickOnce will know that a new version is available and download the files that have changed.
Thanks Saurabh This posting is provided "AS IS" with no warranties, and confers no rights. |
| Saurabh Bhatia MSFT Tuesday, May 12, 2009 8:22 PM |
When you say 'update the deployment version' do you mean changing the version in the .exe.manifest file?
Yes, I tried this, there were 2 locations in this file containing the version number: 1 - <entryPoint><assemblyIdentity
2 - <dependency><dependentAssembly><assemblyIdentity
I incremented the version by 1 and changed the values in these elements to the same new version number.
This still did not work, I had to close all of my browser and execute mage -cc to clear my app cache. Only then did it recognize the change but this time I got an error:
+ Exception reading manifest from XXX: the manifest may not be valid or the file could not be opened. + Manifest XML signature is not valid. + The digital signature of the object did not verify.
It appears the XBAP deployment has hashed that file and stored the hash somewhere (looks like in the .xbap itself).
Is there no simple way to do what I want to do? I simply want to update the config file for the XBAP at runtime and have the XBAP realize the change.
|
| Chris Pope Friday, May 15, 2009 4:33 PM |
Hi Chris, Sorry to hear about your continuing difficulties. Here's some thoughts. I have no idea why you get that error when you have signing disabled on manifests.
- You should be able to store a file on your site of origin (i.e. adjacent to the .xbap file in directory structure) and read it back ... with the app having no knowledge of it ... using a URI like pack://siteoforigin:,,,/myfile.xml. My knowledge of the .config file system is limited here so you may be able to read using actual config APIs... but failing that, you can simply store them in the format of your choice.
- The version you want to rev to stimulate re-download shows up in the .xbap file as : <assemblyIdentity name="YourXbap.application" version="<Your Version>" publicKeyToken="<Your PKT>" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
- IF you change anything in either manifest and it gives you an error, you can automate updating and making the manifest correct by this simple mantra (using command-line mage)
mage -u <your exe.manifest file>
mage -s <your exe.manifest file> -cf <your cert>(ONLY IF SIGNED)
mage -u <your .xbap file> -appm <path to your exe.manifest file>
mage -s <your .xbap file> -cf <your cert> (ONLY IF SIGNED)
- Saurabh Bhatia above is using terminology for the visual side of publishing apps (i.e. from VS 2008 UI), which allows for more and easier configuration than command line, so you may consider that.
I'm going to try your scenario now myself and will let you know (or correct my post) if I find anything unusual.
HTH, Matt
SDET : Deployment/Hosting |
| Matt Galbraith - MSFT Wednesday, May 20, 2009 1:27 AM |
OK I got your recipe to work, here's precisely what I did. Hope this helps...
1) Create un-signed and un-hashed xbap ...
2) Publish this once...
3) Made the following modifications: (note that <Different fromexisting version> must always be the same for you per instance)
In your exe.manifest <asmv1:assemblyIdentity version="<Different fromexisting version>" name="YourXbap.exe" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" /> AND: <file name="YourXbap.exe.config" size="972" /> <-- Needs to match size of modified .config file, and ideally it should change every time.
And In your xbap: <assemblyIdentity name="YourXbap.xbap" version="<Different fromexisting version>" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
<assemblyIdentity name="YourXbap.exe" version="<Different fromexisting version>" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
For me, the tricky part was that I had to modify the version in 3 unique places for it to redownload the whole app, then I got that working and wasn't getting the .config file downloaded as I needed the entry for the size of the file to update too.
Please let me know if this works for you!
-Matt
SDET : Deployment/Hosting- Marked As Answer byLinda LiuMSFT, ModeratorWednesday, May 27, 2009 3:20 AM
-
|
| Matt Galbraith - MSFT Wednesday, May 20, 2009 2:02 AM |