How to fix error "operation could not be completed. Access is denied" that I am getting while sign the assembly.

Aravind Muddeti 0 Reputation points
2025-07-02T18:14:21.13+00:00

When I am trying to sign the Assembly, I am getting below error. I am using Visual Studio Enterprise 2022 and framework 4.6.2. I tried using latest framework as well.
User's image

Developer technologies | Visual Studio | Setup
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Michael Taylor 60,341 Reputation points
    2025-07-02T19:39:19.59+00:00

    This sounds like the old issue of signtool, the program that actually does the signing, not having permissions to access the location where the key, that is used for signing, is stored.

    To test this, restart VS as an admin and then try it again.

    0 comments No comments

  2. Susmitha T (INFOSYS LIMITED) 85 Reputation points Microsoft External Staff
    2025-07-11T08:20:51.0333333+00:00

    Thank you for reaching out. Please find the answer below.

            Run Visual Studio as Administrator

    • Right-click the Visual Studio shortcut and choose "Run as administrator".
    • This gives the signing tool (signtool.exe) elevated permissions it may need.

    Check Permissions on Key File Location

    • Make sure that the account under which Visual Studio is running has adequate permissions to access the key file you are using for signing. You may need to adjust the permissions accordingly.

    Try Signing with a New Key

    • Create a new strong name key file (Sn.exe) and try signing again.
    • Sometimes the existing key file may be corrupted or inaccessible. You can do this from the Visual Studio Developer Command Prompt using the below command:
      sn -R <assembly_path> <key_file_path>

      Verify Assembly Location:

    •  Ensure that you're not trying to sign an assembly located in a protected directory (like System32). Move it to a user directory or use the command prompt to specify the path without the restrictions. If this doesn't resolve your issue, here are a few follow-up questions that could help narrow down the problem:
      • What type of key are you using for signing? Is it a .pfx certificate or a strong name key file (.snk)?
      • Can you confirm that you have permission to access the folder where the key file is stored?
      • Have you tried signing the assembly using command line tools instead of Visual Studio?
        workaround for line command: As a workaround, try using sn.exe or signtool.exe from the Developer Command Prompt with elevated permissions.
      • Are there any other unusual configurations or settings in your project that might affect assembly signing?
      If issue still persist after following all the steps, kindly share the above information with us, we’ll be happy to assist further if needed.
    0 comments No comments

  3. alaxender matthew 0 Reputation points
    2025-07-11T08:57:49.7433333+00:00

    Ensure that your project is configured correctly for assembly signing, and verify you have the necessary permissions to access the key. Also, try updating Visual Studio and the .NET Framework to the latest versions.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.