System.Windows.Forms Version=8

Simon 466 Reputation points
2024-02-28T19:23:17.04+00:00

I keep getting errors that the system is looking for Version 8 references. All I find are System.Windows.Forms.dll - version 4. How do I resolve this error? Should I change all the references to Version 4? In this folder - C:\Program Files\dotnet\sdk\8.0.201
I see only references to versions 3.1, 5.0, 6.0, 8.0 From which folder can I find all the necessary references to version 4, that it should not generate an errorr?

Developer technologies Windows Forms
Developer technologies Visual Studio Other
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2024-02-28T22:02:04.0433333+00:00

    check that you created a net 8 windows form project. check your project file, it should have:

     <PropertyGroup>
       <OutputType>WinExe</OutputType>
       <TargetFramework>net8.0-windows</TargetFramework>
       <Nullable>enable</Nullable>
       <UseWindowsForms>true</UseWindowsForms>
       <ImplicitUsings>enable</ImplicitUsings>
     </PropertyGroup>
    

    the target framework and UseWindowsForms are the key.

    you should also not use any nuget packages that are depend on 4.* framework dlls like System.Windows.Forms.dll (version 4). this is probably your real issue.

    if you need to use a component that uses System.Windows.Forms.dll, then you will need to downgrade to .net 4.8 project.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

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.