MAUI.NET - wpcap DLL not found when using sharpPcap

89 Views Asked by At

I've been working on a project on OS X (arm64) where I've used sharpPcap for packet capture. It was a .NET 7 console app as I was still figuring out the plan ... But everything was working fine, here's the top part of my .csproj :

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

I then decided that I should create a GUI to consume the code I've generated and choose MAUI.NET as it's cross platform. I imported my project as a reference and changed the output type .. The application starts but then says : wpcap dll could not be found .

Switching back to the old .NET 7 everything's works great again. I'm kind of lost there ...

Here's my MAUI csproj :

<PropertyGroup>
    <TargetFrameworks>net7.0-maccatalyst</TargetFrameworks>
    <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
    <!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
    <OutputType>Exe</OutputType>
    <RootNamespace>D2Zaap</RootNamespace>
    <UseMaui>true</UseMaui>
    <SingleProject>true</SingleProject>
    <ImplicitUsings>enable</ImplicitUsings>

    <!-- Display name -->
    <ApplicationTitle>D2Zaap</ApplicationTitle>

    <!-- App Identifier -->
    <ApplicationId>com.companyname.d2zaap</ApplicationId>
    <ApplicationIdGuid>47c29a24-e931-4317-b40a-1c9804dfed48</ApplicationIdGuid>

    <!-- Versions -->
    <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
    <ApplicationVersion>1</ApplicationVersion>

I've tried changing the TargetFrameworks to net7.0, but that seem to result in AppDelegate (MAUI stuff) not being found... Does anybody have some knowledge I couldn't find ?

Or maybe some suggestion some other UI framework that can integrate well with my project ?

Many thanks

EDIT :

After digging the internet it appears that MacCatalyst is a new framework made by apple. MAUI is consuming MacCatalyst for OS X applications. That means that libraries could be different. I'll first try to link pcap library with -lpcap or any other way, if this doesn't work it means that SharpPcap is not compatible with the actual version of .Net MAUI.

Will write an answer soon...

0

There are 0 best solutions below