Fix: Cannot import the following key file

Here’s another quick fix for a small issue you may encounter when upgrading your project to Visual Studio 2010.  You may find that the import works okay, but when you go to compile, you get the following error message:

Cannot import the following key file: keyfile.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_0123456701234567

The cause of the error is exactly as Visual Studio described: it can’t open the key file it needs to access because the key file is password protected.  The suggested fix, however, is not likely to set you on the right path.  In fact, Visual Studio should really just fix this itself.  In previous versions, it would.  Remember you’d occasionally get a password prompt when opening a project for the first time?

Well, all we need to do to fix this is trigger Visual Studio to ask you for the password.  Then, it will do its thing and you’ll be set.  Try this:

  1. Open Project Properties.
  2. Click on the Signing section.
  3. Where it says ‘Choose a strong name key file:’, reselect the current value from the drop-down box:

  4. Visual Studio will now prompt you for the password.  Enter it.

  5. You might get another error message:

    ”An attempt was made to reference a token that does not exist”

    If so, just ignore it.
  6. Click the ‘Change Password” button:

  7. Enter the original password in all three boxes and click OK. If you’d like to change your password (or if your old password doesn’t meet complexity requirements), you can do so now.
  8. Repeat for each key file in your project.
  9. Save your project and do a rebuild.

Of course, there are less empirical ways of solving this, but they involve using the signtool.exe application and messing around with the certificate store.  This might not be the most impressive way of solving this problem, but it seems to work.


  1. thank you for posting
    By guruprakash

  2. i still get the same error. i had changed pfx password, and rebuild but no good.. :(

  3. I also kept getting the error after doing the above steps. Ended up finding that i could simply right-click on the pfx file and import it that way. It brings up a series of prompts, one of which requests the password. After importing them this way my projects were able to build.

  4. I reselected the Key(pfx) file in the "Choose a Strong Name Key File" drop-down box, Then provided password in the "ENTER PASSWORD" Popup Window. Saved my project and did rebuild.It succeeded. Thanks to all

  5. Mine did not work after the suggested fix. But I noticed the "Create Test Certificate" button in the section above. Pressed that key. It asked for the password (which I had just created) I provided it and had my program back.

    I believe the file in question was simply deleted when I rebuilt my system a few weeks ago (from scratch).

  6. trình học tiếng Anh rất tuyệt vời, nó sẽ làm bạn cảm thấy vui khi học đó là Effortless English.
    lớp học kế toán máy thực hành
    trung tâm kế toán tại thái bình
    trung tâm kế toán tại đà nẵng
    Hôm nay Phượt S+ gợi ý các bạn 1 số điểm du lịch nổi bật để đi trong tháng 3 kèm lịch trình sơ lược để mọi người có thể chủ động đi nhé.

  7. سوف مزيج رغوة تصل إلى كل شق. استخدم سدادة الحوض في فخ الرغوة بالداخل. عندما يتوقف الصرير ، اغسل بالماء الساخن. إذا كان لديك مغسلة مزدوجة ، فقم بتصريف المياه في نفس الوقت للحصول على أفضل النتائج.
    شركة تنظيف بالدمام
    شركة تنظيف بالاحساء
    شركة كشف تسربات المياه بالاحساء

  8. شركة تنظيف منازل بالدمام
    شركة تنظيف شقق بالدمام
    شركة تنظيف فلل بالدمام

  9. شركة تنظيف فلل بالدمام
    شركة تنظيف شقق بالدمام
    شركة تنظيف منازل بالدمام

  10. شركة مكافحة الفئران بالرياض
    yueadu wujud alfiran fi almanzil mushkilatan ma , wamin almaeruf 'ana alfiran taeish fi alamakin , walfiran , walfiran alsaghirat , walfiran , walfiran , walfiran , biqard kulin yasnae aliakhshab , al'awraq w ghayriha 'iidha kunt turid altakhalus min alfawdaa alati tastakhdimuha , fayumkinuk 'iimaa kitabatuha 'aw alraqm aladhi turiduhu.

    شركة رش دفان بالرياض
    dmmt alqabr sft lilqabr walays nwe min aleadhab , walam yustthny min hadhih aldamat , kama 'akhbaraha alnby -ealayh alsslat walsslam- eind mawt saed bn mueadh -rdy allah eanhu- , faqala: (law naja ahd min dmat alqbr , linaja sed bn meadh 'iidha 'aradt altakhalus minh faealayk altakhalus minh walan tatamakan min altakhalus minhu.

    شركة مكافحة بق الفراش بالرياض
    albaqu min alhasharat alsaghirat dhat allawn wamusatahat alshakl , wahi albaniyu alati tataeayash mae aljism kaml , watataghadhaa ealaa damih , kama tujad baed al'anwae alati tataghadhaa ealaa dam alkhafafish waltuyur. 'iidha kunt la turid 'an takun qadran ealaa qira'at almazid ean baedikuma albaed , fayumkinuk aikhtiar alshakhs aladhi turid aistikhdamah litahqiq 'aqsaa aistifadatan minhi.

    شركة مكافحة الباعوض بالرياض
    turuq altakhalus min albaeud alnaatijat ean albaeud fay: aistikhdam althalj yusaeid fi jadhb albaeud , kayf yumkin 'an yuntij ghaz thani 'uksid alkarbun , altariqat fi wade althalj dakhil waea' yahtawi ealaa ghita' , wama yanjadhib 'ahamu shay' hu tahqiq 'aqsaa aistifadatan minh , waltakhalus min alfawdaa alati tahtajuha liltakhalus min alfawdaa alati tahtajuha.

    شركة رش مبيدات بالرياض
    tuadiy hadhih alsimat 'iilaa wirathiin wirathiin wirathiin , mimaa yajealuh yataratab ealaa alnabatat alati tatal al'iinsan , walturbat , walma' , mubasharatan waghayr mubashirat , ftsbbb alkathir min al'amrad , siama , w siama , wawasint , waeilim 'iinah min , walturbat , walma'i. taghyir albayanat alkhasat bialraqabati.

    شركة مكافحة الثعابين بالرياض
    la yumkin aleuthur ealaa albayanat fi alnaafidhat , walakin la yumkin 'an taemal , wala yumkin 'an taemali. 'iidha kunt turid altakhalus min alfadalat minh , fahadhih mas'alat waqt faqat qabl 'an tatakhalas minha.
    aistarjae eadad alfajawat min al'ahjar alkarimat 'iilaa hajm alnaafidhat , thuma hadad eadad alfajawat walfajawat almuhadadati.


Copyright © 2010 Paul Guenette and Matthew Sleno.