When I try to access "Application.CommonAppDataPath" i get this error message:
System.Deployment: Store metadata "CurrentBind" is not valid
Stack Trace:
at System.Deployment.Application.ComponentStore.GetPropertyString(DefinitionAppId appId, String propName)
This is only in Debug. When running as an actual published clickonce application it works fine.
How can I get rid of this exception when debugging locally?
I had a similar issue (like jpierson's comment) with the same exception '"CurrentBind" not valid' on ApplicationDeployment.IsNetworkDeployed. I had unchecked "Options|Debugging|General|Just My Code". After checking it back all worked fine.
NOTE: Some other discussion threads had suggested reinstalling VS2010. I did that but did not help. I don't know if reinstalling was also the fator.
I intentionally set VS to break on CLR exceptions. You certainly can mask this exception by only debugging your code but, it is still a valid bug that I'd like an explanation for. MS should be the forerunner on writing solid code.
ApplicationDeployment.IsNetworkDeployed
(in the System.Deployment.Application namespace) is a boolean property that returns true
if the application was launched with ClickOnce.
if (ApplicationDeployment.IsNetworkDeployed)
{
//CommonAppPath code
}
What are you trying to do with CommonAppDataPath? Depending on what you're trying to accomplish, we could probably come up with something that will work no matter how the app is launched.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With