Using built-in WPF Settings for non ClickOnce application - wpf

I have a WPF application that will deployed using InnoSetup (and so presumably will not be a ClickOnce application) that stores user settings with the built-in settings under Properties in the Visual Studio project. I need that the user settings are preserved after each update.
However I have found that if the assembly version changes then the app overwrites the user settings.
In this article (https://msdn.microsoft.com/en-us/library/ms228995.aspx?f=255&MSPPError=-2147217396) it explains for non-clickOnce applications the user settings are stored in the 'Documents and Settings' folder (which is OK), however this is not the case for my project - Is there a setting somewhere in the project so I can declare it a 'non-ClickOnce' application and so therefore get the settings to appear somewhere accessible?
Secondly, I would like that the settings are updated according to that article linked above, will this happen for non-ClickOnce applications?

Related

How to deploy a WPF application?

I have developed a WPF application and deployed it using Click Once Deployment. I installed it on another pc it works fine but the problem is that the application's root folder is being created in a temporary folder in app data/local. I want to give user the flexibility of installing the software wherever he/she wants. How do I do this?
You simply can't change the installation folder using ClickOnce. If you want to do this you need to choose a different installer technology.
ClickOnce application require no administrative privileges and are always installed per user in the user application cache.

Azure Clickonce publishing

we are working on a WPF application which we want to publish as a click once smart client application.
We are able to publish the application on local machine using Visual Studio 2012 and configured it in IIS.
Now we want to upload the published smart client installer to windows Azure Virtual Machine with Windows Server 2012 and IIS 8. We cannot upload the locally published components as the URL configuration in the manifest and deployment file is that of local server. We tried to edit the entries using text editor but once we do the editing the files become unused and it shows xml parsing error when we try to install from the location.
we tried to publish the application direct to the Virtual Machine but it shows an error as Front Page Extension is needed in IIS. We tried to find Front Page extension but couldn't find an version for IIS 8 in Windows Server 2012.
Can any one help us to publish the application in Azure Virtual Machine.
The problem you are having has nothing to do with Azure per se.
In the first case (of editing the XML files), you can do that but it's best to use MageUI to do the edit, because you can then re-sign the manifests. If you just edit the files, it messes up the security on them, and they will not work (as you have found). If you want to edit them with a text editor, you can do that, but then you must re-sign them (using mage); you can create a script to change the installation URL.
Or you can use MageUI. You need to do it in this order:
Open the application manifest in the versioned folder and then save it, re-signing it with your signing certificate.
Open the deployment manifest (yourapp.application) in the top deployment folder. Change the Start Folder to be the right Installation URL. Go to the "Application Reference" tab and re-select the application manifest in the versioned folder. (I know, it hasn't changed, but trust me, you have to do this.) Save this manifest and sign it with your signing certificate.
Copy the deployment manifest from the top folder to the versioned folder. It's always good to keep a copy, so you can go backwards a version if you need to.
NOW you can copy the files to your VM and they will work fine.
In the second case, the Front Page Extensions are required if you are using HTTP to publish the application, yet they are no longer available past about Windows Server 2008(?). So don't use HTTP. Use FTP. Set the publish file location using FTP, like ftp://myserver.mycompany.com/myfolder and set the Installation URL to the HTTP equivalent of it. Then publish it. It will put the files on your VM (assuming FTP is enabled on both sides), and the HTTP link should work.
By the way, you can also host your deployment in Azure blob storage. It is dirt cheap, and you can use something like Cerebrata Cloud Storage Studio or even write your own code to publish it (which I did). This article explains how to put the files out there, what the MIME types need to be, etc. If you do this, then it will work even if you need to replace your VM or redeploy it or the VM becomes unavailable for some reason.
here is a reference to Avkash Chauhan's blog post explaining in detail How to deploy ClickOnce Application using Windows Azure Storage in very simple steps?
http://blogs.msdn.com/b/avkashchauhan/archive/2011/05/09/how-to-deploy-clickonce-application-using-windows-azure-storage-in-very-simple-steps.aspx
He also gives an code example of a windows form (using Wpf) that he shows how to deploy on azure using one click deployment.
hope this helps

Coded UI Test builder fails to recognize controls when XAP is hosted at different domain

The Coded UI Test Builder fails to recognize Silverlight controls when the application (XAP) source is a different domain
I placed XAP at two different locations
http:\Domain1\MyApp\MyApp.XAP
http:\Domain2\MyApp\MyApp.XAP
My WebPage is at http:\Domain1\HomePage.html
If the Silverlight object's source is set to 1st one (same domain) it works fine and CUIT builder recognizes, records and playbacks properly. But, when I set the source to 2nd one (i.e. different domain), the CUIT builder fails to recognize Silverlight app.
The application itself work fine when hosted at Domain1 or Domain2. The recording is also successful when web page at DomainX refers to app at same DomainX. It fails to record when web page at DomainX refers to the same app at DomainY. What do I need to make it work?
Thanks
PS: Please note that the Silverlight application itself works fine no matter from which domain I am using - I have appropriate crossdomain policy file available and enableHtmlAccess set to true.
I have also verified presence of automation helper dll in XAP at both places (infact same XAP has been placed
I had logged this bug on MSDN connect - Coded UI Test builder fails to recognize Silverlight controls in cross domain XAP
This has been marked as "Won't Fix":
"We have investigated this scenario and determined that cross-domain XAPs cannot be supported by Coded UI Test. We use CreateFromXAML apis to enable the UI Testing component for Silverlight and
this API is failing for cross domain XAPs. Unfortunately, we have not been able to identify a workaround either. Closing the bug as Won't fix"

Log installer info when installing WPF App

I have a WPF (Clickonce) app. I want to find out which users are installing or re-installing the app, and probably write those info in a database for audit.
How can I do that?
The current ClickOnce deployment doesn't provide any server-side hooks for monitoring whatsoever (in fact, the "website" generated by ClickOnce publishing is just a very simple, plain HTML page providing a link/button for downloading and executing the .application or setup.exe, respectively, on the client machine. Everything else is taking place locally).
Now, depending on what you want to log (initial installations, or updates, or both) you have the following options:
Create your own website where user will register before getting access to the install/launch for the app (or maybe you just identify them by IP - depends on your needs) - this allows you to log who first installs the app, but not the automatic updates.
In your application, use the classes in the System.Deployment namespace (notably ApplicationDeployment) to access information about updates etc. whenever your application is run. You can then have your app make calls to a web service that you provide, where you can log any installation / launch action (or even other runtime information, like usage of certain features, exceptions etc).
If you are targeting .NET 4, you can have the log files go to a specific folder. Then when the user runs the application, you can have it copy it to your server and delete it, or write it to a database and delete it. Here's an article explaining how to specify where to put the log from a ClickOnce deployment. Note that it runs when you install, update, or uninstall the application.
http://robindotnet.wordpress.com/2010/05/31/enhanced-logging-in-clickonce-deployment/
The registry settings are in HKCU, so you could have your C/O app actually set the info when it first installs. You'll miss the first install log, but it will write the logs to disk after that.
Also note that the article tells you how to turn on verbose logging. You don't have to do that just to write the log to a folder.

Accessing SP 2010 Object Model from Silverlight 4 Application

I have a Silverlight 4 Beta application where I'd like to use the SharePoint object model to upload a document to a SharePoint site - should be simple enough, except an exception is thrown at:
using (SPSite siteCollection = new SPSite(siteCollectionUrl))
The Web application at
http://intranet.fabrikam.com could not
be found. Verify that you have typed
the URL correctly. If the URL should
be serving existing content, the
system administrator may need to add a
new request URL mapping to the
intended application.
This particular exception is actually really well documented out there, it's obviously masking a real underlying issue. Here are some of the things I've read about and tried without success:
DNS / Host Header:
This exception occurs when the particular URL isn't in the IIS metabase because it's being handled by DNS. My web application has an AAM set up and a host header on the web site in IIS. I also tried running the code without using the FQDN of the site, e.g. http: //servername:4860.
Permissions:
The identity of the the Silverlight application pool has db_owner permissions to my content database, and is also a site collection administrator. I can't have both web sites use the same application pool because the Silverlight application needs to run in a .NET app pool.
x86 vs x64:
My Silverlight application has to be compiled for x86 - I'm using some controls that only work in x86. The installed SharePoint version is x64. I've read about people seeing this exception when trying to use the SharePoint object model to hit a x64 SharePoint installation from a x86 app.
Adding then removing permissions for the account: This begins to border on some voodoo magic, but I read about people magically resolving this issue after removing the permissions they set trying to troubleshoot this problem initially. No luck here.
Would appreciate any suggestions, thank you!
Silverlight runs on the client/browser, not on the server - so the server-side SharePoint object model will not be available to you.
However, there is an object model for SharePoint 2010/Silverlight apps - see this MSDN article for details.
To fix the particular error you mentioned, use "List", instead of "SPList". The Silverlight SharePoint object model is a little different from the basic non-Silverlight SharePoint object model.

Resources