Microsoft KB Archive/945357

From BetaArchive Wiki
Knowledge Base


Error message when you click "Calculate Permissions" for a Visual Studio 2008 ClickOnce application: "Calculating permissions failed"

Article ID: 945357

Article Last Modified on 12/12/2007



APPLIES TO

  • Microsoft Visual Studio 2008 Standard Edition
  • Microsoft Visual Studio 2008 Professional Edition
  • Microsoft Visual Studio 2008 Academic Edition



SYMPTOMS

When you click Calculate Permissions on the Security tab for a Microsoft Visual Studio 2008 ClickOnce application, the Calculate Permissions process may not run successfully. Additionally, you may receive the following error message:

Calculating permissions failed.
Could not load file or assembly 'AssemblyPath' or one of its dependencies. An attempt was made to load a program with an incorrect format.

CAUSE

This problem occurs when the Platform target property is set to x64.

WORKAROUND

To work around this problem, use one of the following methods.

Method 1

Change the value of the Platform target property to x86 or to Any CPU. To do this, follow these steps:

  1. In Solution Explorer, click the project name.
  2. On the Project menu, click ProjectName Properties.
  3. Click the Build tab, and then select one of the following items in the Platform target list:
    • x86
    • Any CPU
  4. Click the Security tab, and then click Calculate Permissions.

Note You should use Method 1 only if you are not using 64-bit-specific assemblies. If you use Option 1 when you are using 64-bit-specific assemblies, the Calculate Permissions process fails.

Method 2

Use the PermCalc.exe file to manually create the permissions for your assembly. To do this, follow these steps:

  1. Click Start, click Run, type cmd, and then click OK.
  2. Type the following command, and then press ENTER:

    cd DriveLetter:\ Program Files\Microsoft SDKs\Windows\v6.0A\bin\

  3. Type the following command, and then press ENTER:

    PermCalc –CleanCache "AssemblyPath"

  4. Locate and then open the XML file that the PermCalc.exe file created.
  5. Copy and then paste the contents of the XML file into the App.manifest file in your project.


STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Keywords: kbtshoot kbpubtypekc kberrmsg kbprb KB945357