none
Generating SampleKey.snk File - Access Denied RRS feed

  • Question

  • Hello,
     
    I was trying to create the strong name key file as explained on the project site for "Readme_Excel2 Custom Connection Manager Sample" using "sn -k SampleKey.snk" on the command prompt started from Visual Studio 2008 Command Prompt.

    My setup include Visual studio 2008 trial version with Framework 3.5 and MS SQL Express Server.

    I have installed the samples for 2008.

    When I run the command I get following error:

    "Microsoft (R) .NET Framework Strong Name Utility  Version 3.5.21022.8
    Copyright (c) Microsoft Corporation.  All rights reserved.

    Failed to create SampleKey.snk -- Access is denied."

    Any Help will be appreciated.

    I have classified it in SQL Server Security Thread. If not OK kindly Guide. This is my first submission to the forums.
    Sunday, December 28, 2008 8:55 PM

Answers

  •  

      Welcome to the MSDN forums. The particular forum where you posted the original question is intended for SQL Server Security threads only. I am redirecting the thread to the proper forum where the Visual Studio experts may be able to provide better guidance.

    Generally speaking the Access Denied error occurs when the principal (Windows) context executing the operation doesn’t have privileges to accomplish the task. In this case, based on your description, my guess would be that you tried to create the SNK file on a protected folder (very likely “Microsoft Visual Studio 9.0\VC”, if you used the VS command prompt to execute the sn command).

      Make sure you specify a filename using a folder where you have permission to create new files, for example:

     sn -k "%USERPROFILE%\SampleKey.snk”

      I hope this information helps,

      -Raul Garcia
       SDE/T
       SQL Servr Engine


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, December 29, 2008 1:21 AM
  • Thanks Raul,

    Your suggestion helped me.
    As I have Vista installed this problem was occuring. Even thoug I am using a Windows account with administrative rights it does not allow to go through in the samples folder directly. I chnaged the permissions on the folder and allowed for the current user and it worked.

    Also I have found that the generation of the file can be carried out inside the Visual Studio 2008 itself. On the Properties signing tab when we click on the arrow by the side of the Choose a strong name key file: we get an option which says "<New>". Clicking on that a dialog box appears in which the Key file name can be provided and even the password for the file can be set. It generates the file at the correct place for the sample.

    Thanks a lot to all.

    Hope to have similar quick responses in future.
    I have really found a good set of people to fall back upon. Till I now I used to break my head and invest hours just finding a solution. Now I know that there are friends whom I can reach to.

    Regards,
    Animesh
    • Marked as answer by Animesh Monday, December 29, 2008 3:55 PM
    Monday, December 29, 2008 3:54 PM

All replies

  •  

      Welcome to the MSDN forums. The particular forum where you posted the original question is intended for SQL Server Security threads only. I am redirecting the thread to the proper forum where the Visual Studio experts may be able to provide better guidance.

    Generally speaking the Access Denied error occurs when the principal (Windows) context executing the operation doesn’t have privileges to accomplish the task. In this case, based on your description, my guess would be that you tried to create the SNK file on a protected folder (very likely “Microsoft Visual Studio 9.0\VC”, if you used the VS command prompt to execute the sn command).

      Make sure you specify a filename using a folder where you have permission to create new files, for example:

     sn -k "%USERPROFILE%\SampleKey.snk”

      I hope this information helps,

      -Raul Garcia
       SDE/T
       SQL Servr Engine


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, December 29, 2008 1:21 AM
  • Hi Animesh

    I'm sorry you're getting a "run around" and hope we can quickly get your question to a place it can be answered. The VSTO forum is definitely not the right place and I can't understand why your message was moved here (more information about the VSTO forum can be found in the forum's "Please Read First" message).

    Given that the article you're working with is part of the SQL Server documentation on MSDN it's not surprising you post your question in that set of forums. Your problem, however, is not with SQL Server, it's with something to do with your solution in conjunction with the .Net Framework: the tool that assists in strong-naming a solution.

    I believe the "Common Language Runtime" forum is the correct place to find out why you're not able to use the Strong Name Utility. I'm going to move this message thread there.
    Cindy Meister, VSTO/Word MVP
    Monday, December 29, 2008 8:32 AM
    Moderator
  • Thanks Raul,

    Your suggestion helped me.
    As I have Vista installed this problem was occuring. Even thoug I am using a Windows account with administrative rights it does not allow to go through in the samples folder directly. I chnaged the permissions on the folder and allowed for the current user and it worked.

    Also I have found that the generation of the file can be carried out inside the Visual Studio 2008 itself. On the Properties signing tab when we click on the arrow by the side of the Choose a strong name key file: we get an option which says "<New>". Clicking on that a dialog box appears in which the Key file name can be provided and even the password for the file can be set. It generates the file at the correct place for the sample.

    Thanks a lot to all.

    Hope to have similar quick responses in future.
    I have really found a good set of people to fall back upon. Till I now I used to break my head and invest hours just finding a solution. Now I know that there are friends whom I can reach to.

    Regards,
    Animesh
    • Marked as answer by Animesh Monday, December 29, 2008 3:55 PM
    Monday, December 29, 2008 3:54 PM