“Store metadata ”CurrentBind“ is not valid” in debug of ClickOnce application

后端 未结 4 925
孤独总比滥情好
孤独总比滥情好 2021-02-19 08:52

When I try to access \"Application.CommonAppDataPath\" i get this error message:

System.Deployment: Store metadata \"CurrentBind\" is not valid

相关标签:
4条回答
  • 2021-02-19 09:24

    I had exactly the same problem. Thanks to mkale for pointing me in the right direction.

    I had installed the Reflector VS Addin a few days ago, and at some point it asked about changing the Just My Code option. I had completely forgotten about it, and have been messing around with this problem for the last two days!

    At the same time I also had a problem with FileLoadException - which was reporting in the Fusion log that "WRN: Comparing the assembly name resulted in the mismatch: Revision Number". Initially I got around that problem by setting the assembly version to 1.1.0.0 instead of as 1.1.*.

    However, once having set the Just My Code option, all these problems disappeared.

    0 讨论(0)
  • 2021-02-19 09:29

    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.

    0 讨论(0)
  • 2021-02-19 09:36

    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.

    0 讨论(0)
  • 2021-02-19 09:42

    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.

    0 讨论(0)
提交回复
热议问题