Como adicionar uma referência de FrameWork no VS 2022

José Carlos 886 Reputation points
2023-03-25T12:25:00.24+00:00

Hi friends,

I have a C++ WInforms application that has stopped working because I must have deleted some .NET Framework linked to the application. It gives several errors. In all words System. I already installed .NET Framework 4.7.2 on the computer but the error persists. I thought about adding reference in Visual Studio but I don't see .NET Framework 4.7.2. How do I recover this application?

How to Add a FrameWork Reference in VS 2022

Tks

Developer technologies | C++
Developer technologies | Visual Studio | Other
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 34,456 Reputation points Microsoft External Staff
    2023-03-27T09:01:05.69+00:00

    Hi @José Carlos Souza,

    Welcome to Microsoft Q&A forum.

    If you try to create a new but the same project by using VS 2022, in the wizard, is .NET Framework 4.7.2 available to be selected?

    If .NET Framework 4.7.2 is unavailable, then please try to reset VS settings(open Developer Command Prompt for VS 2022 > run devenv /ResetSettings) and repair .NET Framework 4.7.2 by using .NET Framework Repair Tool. If it doesn’t work, please try to install .NET Framework 4.8 and test again.

    If .NET Framework 4.7.2 is available, please share us some detailed error message to check. In addition, can you confirm that these errors appeared due to the deleted .NET Framework, instead of some settings(for example Properties > Configuration Properties) have been changed in your project?

    Besides, have you tried to remove the hidden .vs folder and rebuild your project? Are you using any extensions, and did you remember what you have done before these errors appeared?

    Please feel free to contact us.

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Erkan Sahin 840 Reputation points
    2023-03-25T12:31:09.49+00:00

    To add a .NET Framework reference in Visual Studio 2022, follow these steps:

    1. Open your project in Visual Studio 2022.
    2. Right-click on the project in the Solution Explorer and select "Add Reference...".
    3. In the Reference Manager, select "Framework" on the left-hand side.
    4. Select the version of the .NET Framework you want to use (in this case, .NET Framework 4.7.2).
    5. Select the checkbox next to the appropriate assemblies you want to reference. You may need to scroll down to find the specific assemblies you need.
    6. Click the "OK" button to add the references.

    If you've already installed .NET Framework 4.7.2 on your computer, you should be able to see it in the Reference Manager. If you don't see it, you may need to install it again or repair your .NET Framework installation. Once you've added the necessary references, rebuild your project to see if the errors are resolved.

    Please mark the answer as helpful if it helps you :-)

    0 comments No comments

  2. José Carlos 886 Reputation points
    2023-03-25T12:46:00.84+00:00

    Hi Erkan

    I already installed .NET Framework 4.7.2 twice. By the way it did not let install again. Said it was already installed. It just doesn't show up in the Reference Manager. Would it be in the FrameWork or COM Assemblies Menu on the left of the Manager? Nothing appears on either one.

    0 comments No comments

  3. José Carlos 886 Reputation points
    2023-03-27T13:10:58.16+00:00

    Hi Tianyu

    Many thanks for the reply.

    The issue was resolved by resetting the parameters with the command at the prompt you provided.

    I must have deleted something I shouldn't have.

    Everything went back to normal.

    Tkd

    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.