Results 1 to 3 of 3

Thread: [RESOLVED] Adding System.Windows.Forms to .Net 8 dll

  1. #1

    Thread Starter
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Resolved [RESOLVED] Adding System.Windows.Forms to .Net 8 dll

    From everything I have seen, this should be possible, but for some reason, I haven't been able to add System.Windows.Forms to a .Net 8 class library project. I need to add a custom cursor, which is the immediate issue, but I realized I will eventually want to add a form to this class library. I would have thought that I could add this through NuGet, but it isn't showing up. All I'm seeing online makes it seem like this should be nothing special. There aren't any instructions, because there clearly don't need to be, yet I'm not seeing it.

    What am I missing?
    My usual boring signature: Nothing

  2. #2
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    579

    Re: Adding System.Windows.Forms to .Net 8 dll

    Create new project as Windows Forms Class Library and you will have all that you need. Check the created .vbproj as it contains required settings. For example:
    Code:
    <Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <RootNamespace>WinFormsLibrary1</RootNamespace>
        <TargetFramework>net8.0-windows</TargetFramework>
        <UseWindowsForms>true</UseWindowsForms>
      </PropertyGroup>
    
      <ItemGroup>
        <Import Include="System.Data" />
        <Import Include="System.Drawing" />
        <Import Include="System.Windows.Forms" />
      </ItemGroup>
    
    </Project>

  3. #3

    Thread Starter
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: Adding System.Windows.Forms to .Net 8 dll

    Yeah, that gets it. Adding the missing parts to .vbproj also works. Strange that I couldn't find it, though.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width