Compiling DirectShow.Net for use in .NET 5

In a previous blog post, I wrote about how to access webcam properties from C# using DirectShow.Net. The last release of the library is version 2.1 from February 2010, with project files for Visual Studio 2008.

Fortunately, porting the project to compile for .NET 5 went pretty quick.

The project file

<Project Sdk="Microsoft.NET.Sdk">



Things to note:

  • The target framework is net5.0-windows because the code (obviously) uses Windows-specific features.
  • I added <GenerateAssemblyInfo>false<GenerateAssemblyInfo> to use the AssemblyInfo.cs file that came with the original project.


The following modifications were necessary:

  • Change AssemblyVersion from 2.1.0.* to because the compiler complained about the wildcard.
  • Remove the lines related to the .snk file (now handled in the project file).
  • Add SupportedOSPlatform("windows").
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Permissions;

[assembly : AssemblyTitle("DirectShow Net Library")]
[assembly : AssemblyDescription(".NET Interfaces for calling DirectShow.  See")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("")]
[assembly : Guid("6D0386CE-37E6-4f77-B678-07C584105DC6")]
[assembly : AssemblyVersion("")]
[assembly : AssemblyProduct("Debug Version")]
[assembly : AssemblyProduct("Release Version")]
[assembly : AssemblyCopyright("GNU Lesser General Public License v2.1")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
[assembly : AssemblyDelaySign(false)]
// Path is relative to the resulting executable (\Bin\Debug)
[assembly : AssemblyKeyFile("..\\..\\DShowNET.snk")]
[assembly : AssemblyKeyName("")]
[assembly : ComVisible(false)]
[assembly : CLSCompliant(true)]
[assembly : SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode=true)]
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows")]


The DirectShow.Net library is licensed under the Lesser General Public License (LGPL) Version 2.1.

To be able distribute my software at some point in the future, the LGPL license requires – in addition to proper attribution – to

  • ship the library as an individual DLL (instead of ripping out just the parts that I need), and to
  • make the source code available publicly.

In order to comply with the LGPL, I published my fork of the library on

Please note that I did not perform any tests of features that go beyond accessing webcam properties. The library compiles, I can use it in my project, and so far it did not break my code – that’s good enough for me at this moment…

No Comments