Home

C# Visual Studio 2019 Create DLL

Really simple to create a DLL in VS2019

File --> New Project --> in the search box type DLL otherwise you'll have to scroll through loads of options

Using the search for DLL in the create new project window of VS2019

Choose the C# Class Library - unless ya wanna do it in VB.

Give the project a name, preferable summat relevant. Also choose the .NET Framework. Might be best to wind it back if you aint sure where it's going to end up.

Go to Create then you'll be presented with

VS will present you with the screen to allow you to start coding for your DLL

And away you go...WAIT. Here's an example to get you going.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MasterDLL
{
    public static class Class1
    {
        public static string MyHello()
        {
            string x = "Hello World";
            return x;
        } 
    }
}

The mistake I made was to not insert the "static". Dunno what it means but it works now.

To create the DLL 

Build --> Build Solution

You'll find your DLL in the folder listed in the output 

The page shows where the created DLL file will be stored

Drop this into your Bin folder of the web page and add a "using..." and away ya go.

 

 

Reader's Comments

Post Your Comment Posts/Links Rules

Name

Comment

Add a RELEVANT link (not required)

Upload an image (not required)

No uploaded image
Real person number
Please enter the above number below




Home
Admin Ren's Biking Blog