ffmpeginteropx / FFmpegInteropX

FFmpeg decoding library for Windows 10 UWP and WinUI 3 Apps
Apache License 2.0
210 stars 53 forks source link

Support for .Net 7 WINUI-3 apps #360

Closed touseefbsb closed 1 year ago

touseefbsb commented 1 year ago

I made a new project for win ui 3 and the app is targeted to .Net 7 and when I try to install FFmpegInteropX nuget on it it fails.

<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>

Package FFmpegInteropX 1.0.1 is not compatible with net7.0-windows10.0.19041 (.NETCoreApp,Version=v7.0). Package FFmpegInteropX 1.0.1 supports: uap10.0 (UAP,Version=v10.0)

brabebhin commented 1 year ago

Use the pre-release package or check out the winUI sample in the repository.

touseefbsb commented 1 year ago

Ok I did that and now I was able to install it however I am getting following error :

Error NETSDK1148 A referenced assembly was compiled using a newer version of Microsoft.Windows.SDK.NET.dll. Please update to a newer .NET SDK in order to reference this assembly.

and I tried installing latest .Net 7 SDK on my machine as well. maybe because the nuget is based on .Net 6 ? could that be the reason?

brabebhin commented 1 year ago

The nuget should work with NET 6. Not sure about 7, and it's unlikely we will support 7 cause it is a short support version. Did you install the package or is the project referenced directly?

touseefbsb commented 1 year ago

I installed the package. if downgrading my winui project to .net 6 is the only option then sure I can adjust my solution accordingly. But I was hoping to make it work with .net 7 since all winui nugets and even the template studio project generation creates it with .net 7

brabebhin commented 1 year ago

The best way to work with 7 is to reference the project directly and manually up the version number.

You should be aware we don't fully support winUI 3, partly because of bugs on CsWinRT and partly cause we need a separated build.

lukasf commented 1 year ago

This is a WinUI thing. You need to manually specify a higher Windows SDK Ref version in the project file. Check here:

https://platform.uno/docs/articles/features/winapp-sdk-specifics.html

For the version number, use your target SDK version number, and for the last digit use the highest revision you find for that number on NuGet: https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref

brabebhin commented 1 year ago

Yes IIRC you need to do some manual changes to the template VS creates in order to use our library.

touseefbsb commented 1 year ago

ok so I have updated my project file like so that I added a new ItemGroup with the 2 FrameworkReference tags and added the latest version of versions as described but it is still failing with the following error :

image

Error :

image

the error points to NETSdkError in this file Microsoft.Net.Windows.targets

image

lukasf commented 1 year ago

Our lib has platform target 10.0.22000.0. I think you must use at least this version (or higher) in your app. I just checked our WinUI sample: It also does not compile if I use a lower target sdk than the lib.

touseefbsb commented 1 year ago

Thanks it is building now.

lukasf commented 1 year ago

Glad to hear that. You might be able to remove the FrameworkReference thing, since most of the time things work fine without it.