C# code to component

Hi, how can I put this into a C# component and let it work for Grasshopper?

using System;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Types;
using NAudio.Wave;

namespace RandomSoundGenerator
{
    public class RandomSoundGenerator : GH_Component
    {
        private readonly WaveOutEvent _waveOut = new WaveOutEvent();
        private readonly Random _random = new Random();
        private WaveFileWriter _writer;

        public RandomSoundGenerator() : base("Random Sound Generator", "RSG", "Generates random sound", "Category", "Subcategory") {}

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            int sampleRate = 44100;
            int duration = 5;
            int channels = 1;

            byte[] soundData = new byte[sampleRate * duration * 2];
            for (int i = 0; i < soundData.Length; i++)
            {
                soundData[i] = (byte)_random.Next(256);
            }

            var format = new WaveFormat(sampleRate, channels);
            _writer = new WaveFileWriter("RandomSound.wav", format);
            _writer.Write(soundData, 0, soundData.Length);
            _writer.Close();

            DA.SetData(0, "Random sound file generated");
        }

        protected override System.Drawing.Bitmap Icon => null;

        public override Guid ComponentGuid => new Guid("{component-guid}");
    }
}

Could work. I need to find out where is NAudio.Wave. It should be in a dll file.

Run code successfully in VS, it generated a wav file on disk. But didn’t make it in c# component.
Error (CS0012): The type ‘System.IO.Stream’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. (line 76)