21

I just downloaded Visual Studio 2022 (Although I much preferred 2019 but can't find it) and as soon as I open a simple "Hello World" project and try to run it, I have an error. this is pain

Using .Net 5.0 Runtime am I missing a file in my downloads?

How can I fix this? is this a 2022 issue or if I miraculously find Visual Studio 2019 somewhere online it'll show the same error?

UPDATE: 2019 works fine, it's just 2022. I'll work on 2019 but if anyone has a solution maybe it'll help other people :)

Ariella
  • 247
  • 1
  • 3
  • 7

6 Answers6

15

More googling, and the fix for me turned out to be VS-Installer borking the install;

"Development tools for .NET" - was never installed.. Because I deselected F# language support.

My solution found via https://developercommunity.visualstudio.com/t/vs-2022-preview-2-the-project-doesnt-know-how-to-r/1491655

MisterNad
  • 432
  • 3
  • 14
8

I met the same issue today and finally solved it. My steps:

  1. open the Visual Studio Installer, under the "Installed" label, you can see the installed vs2022.
  2. click "More" and then choose the first "Repair" option.
  3. wait about 30 minutes' repair and restart the system by the tips.
ophunter
  • 81
  • 1
  • I did this and it still doesn't work. As soon as I restarted, I got a different error message, one that was supposedly only fixable by loading your solution from File Explorer directly. When I did that, I started getting this bug again. I saw a bug report that told me to go to [this Visual Studio installer](https://marketplace.visualstudio.com/items?itemName=ProjectReunion.MicrosoftSingleProjectMSIXPackagingToolsDev17) to fix it but it still didn't help – puppydrum64 Dec 13 '21 at 00:31
  • I have the exact same issue with VS2022, 2019 works fine with my existing project. Jumped through the same hoops with repair and VSIX, does not work for me. If I create a brand new "Hello world" Console app, vs2022 will not run it - same message. – MCrossley Dec 14 '21 at 18:26
  • This is what did it for me. Other options didn't work. – Dash83 Feb 09 '23 at 11:24
8

I fixed it! Here's what I did

  1. Open Visual Studio Installer and click on "Modify" under VS2022
  2. Install the following: .NET desktop development under Desktop & Mobile, and Office/SharePoint development under Other Toolsets

Tell me if it worked :)

Sohmtee
  • 96
  • 1
  • 2
1

And less than 15 minutes after commenting I have the same issue, MS release v17.0.3 of vs2022. After upgrading to that, the error message has gone and I can run my projects again!

MCrossley
  • 123
  • 2
  • 8
0

Using the Modify action in "Uninstall or change a program" fixed it for me. Most notably my VS2022 installation had "forgotten" the Desktop workflow selection that I selected at the original installation.

Tom A
  • 595
  • 7
  • 16
0

I had a project made in VS 2019 I set up a new PC installed latest VS 2022 When I pulled my projects down from GitHub I kept getting this error project would run and say build error the .pfx file had issues MSB3325 and another error Here's how I fixed it

I ran the VS 2022 installer again Click modify check and install .net desktop development To install the tools you need to fix

Side note: which should have been installed to begin with....??? Thanks MS shouldn't the dev tools be downloaded with the VS 2022 dev creator program....???

You have to type in the password for your pfx file for each project folder in the VS 2022 developer console window

On Windows 10 open visual studio 2022 click the search box next to help on the menu bar type developer command prompt cd to the directory of your project run the following command

sn.exe -i xxx.pfx VS_KEY_xxx

On VS 2022 click on the error list window

You will see the name of the pfx file in an error message

You will see another error and the VS_KEY_number

sn.exe -i nameofyourpfxfile.pfx VS_KEY_yourkeynumber

Keep windows open Run your project again and now it builds

Do this for every project you import as needed to fix the pfx key lock password error

KeyOnTech
  • 1
  • 2