|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Passing URI Parameters to WPF App Affecting DeploymentI have created a WPF "stand-alone" application that is deployed via ClickOnce
over http. One of the features I want to take advantage of is the ability to pass parameters through the activation URI. I have checked the option to allow this for the project. Then I use the client to install the app via ClickOnce. Then on subsequent uses if I want to change the URI parameters, I get a prompt that indicates that the app was deployed from a different location. If the parameters do not change, then it works perfectly well. Is there any way around this? Thanks for the assistance. Hi,
Based on my understanding, you have a WPF Windows Application project and publish the application via ClickOnce. Your problem is that after you install the WPF application on a client machine and active the WPF application via a URL with changed parameters, you get a prompt indicating that the application was deployed from a different location. If I'm off base, please feel free to let me know. I performed a test on this issue but didn't reproduce the problem. The following are the steps of my test: 1. Create a WPF Windows Application project and add a TextBox on the Window1.xaml. In the Window1.xaml.cs file, write down the following code: public partial class Window1 : System.Windows.Window { public Window1() { InitializeComponent(); this.Loaded += new RoutedEventHandler(Window1_Loaded); } void Window1_Loaded(object sender, RoutedEventArgs e) { if (ApplicationDeployment.IsNetworkDeployed) { string url = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData[ 0]; string queryString = (new Uri(url)).Query; this.textBox1.Text = queryString; } } } 2. Right click the WPF project in the Solution Explorer and choose Propeties. In the Project Designer, switch to the 'Publish' tab. 3. Type 'http://localhost/WPFApplication/' in the 'Publishing Location' textbox. 4. Click the Options button. In the Publish Options dialog, select the checkbox before the 'Allow URL parameters to be passed to application' option. 5. Publish the application and install it on the local machine. 6. Open IE and type 'http://localhost/WPFApplication/WPFApplication.application?name=value' in the address bar and press the Enter key. The WPF application launches and shows '?name=value' in the TextBox. 7. Close the application and change the query string in IE address bar and press the Enter key. The WPF application launches again and shows the new query string in the TextBox. Is there any difference between your application and mine? You may also have a try creating a new simple WPF Windows Application project to see if the problem still exists. Sincerely, Linda Liu Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. You are correct in understanding what the problem is.
I have taken the code you posted and created a new WPF app named "paramtest". I then published and installed the application using http://localhost/WPFApplication.paramtest.application. Then closed the application and attempted pulling up the app using http://localhost/WPFApplication.paramtest.application?name=value and received the incorrect location error below: - Source: System.Deployment - Stack trace: at System.Deployment.Application.ApplicationActivator.CheckDeploymentProviderValidity(ActivationDescription actDesc, SubscriptionState subState) at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut) at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state) --- Inner Exception --- System.Deployment.Application.DeploymentException (DeploymentUriDifferent) - Running paramtest from http://localhost/WPFApplication/paramtest.application?name=value is not allowed because you have already installed it from a different location http://localhost/WPFApplication/paramtest.application. If you want to run paramtest from http://localhost/WPFApplication/paramtest.application?name=value, you must first uninstall it from Add or Remove Programs and then reinstall it from the new location. If you reinstall, be aware that your application settings will be restored to their default settings. - Source: System.Deployment - Stack trace: at System.Deployment.Application.ApplicationActivator.CheckDeploymentProviderValidity(ActivationDescription actDesc, SubscriptionState subState) Show quote "Linda Liu[MSFT]" wrote: > Hi, > > Based on my understanding, you have a WPF Windows Application project and > publish the application via ClickOnce. Your problem is that after you > install the WPF application on a client machine and active the WPF > application via a URL with changed parameters, you get a prompt indicating > that the application was deployed from a different location. If I'm off > base, please feel free to let me know. > > I performed a test on this issue but didn't reproduce the problem. The > following are the steps of my test: > > 1. Create a WPF Windows Application project and add a TextBox on the > Window1.xaml. In the Window1.xaml.cs file, write down the following code: > > public partial class Window1 : System.Windows.Window > { > public Window1() > { > InitializeComponent(); > this.Loaded += new RoutedEventHandler(Window1_Loaded); > } > > void Window1_Loaded(object sender, RoutedEventArgs e) > { > if (ApplicationDeployment.IsNetworkDeployed) > { > string url = > AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData[ > 0]; > string queryString = (new Uri(url)).Query; > this.textBox1.Text = queryString; > } > } > } > > 2. Right click the WPF project in the Solution Explorer and choose > Propeties. In the Project Designer, switch to the 'Publish' tab. > > 3. Type 'http://localhost/WPFApplication/' in the 'Publishing Location' > textbox. > > 4. Click the Options button. In the Publish Options dialog, select the > checkbox before the 'Allow URL parameters to be passed to application' > option. > > 5. Publish the application and install it on the local machine. > > 6. Open IE and type > 'http://localhost/WPFApplication/WPFApplication.application?name=value' in > the address bar and press the Enter key. > The WPF application launches and shows '?name=value' in the TextBox. > > 7. Close the application and change the query string in IE address bar and > press the Enter key. > The WPF application launches again and shows the new query string in the > TextBox. > > Is there any difference between your application and mine? You may also > have a try creating a new simple WPF Windows Application project to see if > the problem still exists. > > Sincerely, > Linda Liu > Microsoft Online Community Support > > ================================================== > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif > ications. > > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues > where an initial response from the community or a Microsoft Support > Engineer within 1 business day is acceptable. Please note that each follow > up response may take approximately 2 business days as the support > professional working with you may need further investigation to reach the > most efficient resolution. The offering is not appropriate for situations > that require urgent, real-time or phone-based interactions or complex > project analysis and dump analysis issues. Issues of this nature are best > handled working with a dedicated Microsoft Support Engineer by contacting > Microsoft Customer Support Services (CSS) at > http://msdn.microsoft.com/subscriptions/support/default.aspx. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no rights. > > Hi,
Thank you for your feedback! > I then published and installed the application using http://localhost/WPFApplication.paramtest.application.It seems that the URL should be "http://localhost/WPFApplication/paramtest.application". You may miswrote it, right? Could you please tell me what the OS is on your machine? I have performed tests publishing the WPF application via ClickOnce to both Windows Vista and XP, and installing the application on the same machine. The WPF application is activated properly no matter what the URL and query string is I use to launch the application. I suggest you have a try on another machine, i.e. publish the WPF application to another machine and then install the application via ClickOnce on that machine to see if the problem still exits. To narrow down the problem, you may also perform a test on WinForm application to see if the problem exists. Sincerely, Linda Liu Microsoft Online Community Support Hi,
How about the problem now? If the problem is still not resolved, please feel free to let me know. Thank you for using our MSDN Managed Newsgroup Support Service! Sincerely, Linda Liu Microsoft Online Community Support Sorry for the delay in getting back to you. I had to work with our IT dept
to get another environment setup to test this. We created a completely separate environment, running WinXP SP2, IE7, .NET 3.5 and all latest updates. I then published the test app to that machine, and installed on the machine using ClickOnce through IE7. Note: When installing I did not specify any URI parameters (i.e. http://server/app/app.application). Once installed, I then closed the app, and re-opened IE7, and went to the same URI, only this time I added "?param=value" (i.e. http://server/app/app.application?param=value). I then get the message metioned in the first post. Still no luck... Hi,
Thank you for your feedback! I have searched our internal database, but didn't find a simliar issue in it. To narrow down this problem, I suggest that you perform a test on WinForm application to see if the problem still exists. If the problem still exists, could you please send me a sample WPF application project that could just reproduce the problem? To get my actual email address, remove 'online' from my displayed email address. Sincerely, Linda Liu Microsoft Online Community Support Hi Justin,
I performed a test on your sample application and did reproduce the problem on my side. I install the ClickOnce application via a URL without any query string and then try to launch the installed application via a URL with a query string. At this time I get the same exception as you got. Since that you create and deploy the application using VS2008 Beta2, it seems that this problem is related to this version of VS. This problem doesn't exist in VS2005, so I suggest that you use VS2005 to create and deploy the application. Since we don't support VS2008 Beta, you may submit a bug report in the Microsoft connect web stie via the following link: http://connect.microsoft.com/VisualStudio/Feedback Thank you for understanding and support for Microsoft! If you have any question, please feel free to let me know. Sincerely, Linda Liu Microsoft Online Community Support |
|||||||||||||||||||||||