views:

291

answers:

1

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?

A: 

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.

whatknott
I am saving the settings.xml-file for my program in Application.CommonAppDataPath\ProgramName\ path.
Espo
Strangely I'm getting the same error that the original poster described when attempting to read the ApplicationDeployment.IsNetworkDeployed property.Store metadata "CurrentBind" is not valid.
jpierson
Me too ApplicationDeployment.IsNetworkDeployed just give the same error. Followed by an "Application is not installed" error.
Sam Mackrill