Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinForms/WPF .NET Core 3 support for LibVLCSharp #71

Merged
merged 2 commits into from
Oct 13, 2019

Conversation

dashkan
Copy link
Contributor

@dashkan dashkan commented Oct 9, 2019

Description of Change

I apologize for not updating the existing PR. I had so many problems trying to rebase. I no longer have issues building w/ MSBuild.Sdk.Extras 2.0..54.

You can run the winforms sample by running dotnet run -f netcoreapp3.0 from sample directory.

Add support for .net core 3.0 winforms and wpf. Update winforms sample to support netcoreapp3.0.

Issues Resolved

API Changes

None

Platforms Affected

New platform added

  • netcoreapp3.0

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

PR Checklist

  • Rebased on top of the target branch at time of PR
  • Changes adhere to coding standard

@jeremyVignelles
Copy link
Collaborator

Probably better that way rather than rebasing 😉

@dashkan dashkan changed the title WinForms/WPF .NET Core 3 support for LibVLCSharp / Part 2 WinForms/WPF .NET Core 3 support for LibVLCSharp Oct 9, 2019
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use MSBuild.Sdk.Extras here :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about that. MSBuild.Sdk.Extras was great in setting up xamarin/WPF project with sdk-style csproj with VS2017. Now that VS 2019 and net core 3 are out, the Windows desktop sdk does that job for VS2019, and I guess dotnet CLI too.
I tried MSBuild.Sdk.Extras 2.x not too long ago, and I didn't manage to make it work with VS 2017 anyway. I'm in favor of migrating to VS 2019.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can keep support for VS2017 without effort, I say we should.

And referencing MSBuild.Sdk.Extras here makes it follow the same convention than the WPF package (i.e. Microsoft.NET.Sdk.WindowsDesktop is implicitly referenced AFAIK).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I fear about the "without effort" part. I'm not sure VS2017 is still officially supported by MSBuild.Sdk.Extras...

@mfkl
Copy link
Member

mfkl commented Oct 10, 2019

Thanks for the new PR.

So, this works fine with both CLI and VS2019 (had to update to 16.3.3 though).

It sadly doesn't build with VS2017 however.

2>C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0.

Adding

"sdk": {
    "version": "3.0.100"
  }

to global.json triggers a bug in MSBuildSdkExtras novotnyllc/MSBuildSdkExtras#190.

2>C:\Users\Martin\.nuget\packages\msbuild.sdk.extras\2.0.54\Sdk\Sdk.props(16,5): error MSB4184: The expression "[System.IO.Path]::GetDirectoryName('')" cannot be evaluated. The path is not of a legal form.

Let's see if we can get this fixed, or we will drop VS2017 build support for these projects.

@@ -2,16 +2,19 @@
<PropertyGroup>
<Title>LibVLCSharp.WinForms.Sample</Title>
<OutputType>WinExe</OutputType>
<TargetFramework>net40</TargetFramework>
<TargetFrameworks>net40;netcoreapp3.0</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove that line, it's already here.

<RootNamespace>LibVLCSharp.WinForms.Sample</RootNamespace>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.8" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net40'">
<Reference Include="System.Windows.Forms" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never tried netcoreapp 3.0 projects yet, but does UseWinForms add this reference only for netcoreapp or net framework applications as well?
I'd expect microsoft to ease multi-targetting as much as possible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, unnecessary.

@@ -31,7 +32,7 @@ LibVLC needs to be installed separately, see VideoLAN.LibVLC.* packages.
<PackageReleaseNotes>https://code.videolan.org/videolan/LibVLCSharp/blob/master/NEWS</PackageReleaseNotes>
<PackageTags>libvlc;vlc;videolan;native;c/c++;video;audio;player;media;mediaplayer;codec;ffmpeg;xamarin;graphics;ios;android;linux;windows;macos;cross-platform</PackageTags>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net461'">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if we can use the windows desktop sdk and clean up that file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep this whole ItemGroup can be removed.

@@ -50,6 +51,6 @@ LibVLC needs to be installed separately, see VideoLAN.LibVLC.* packages.
</Page>
<Page Remove="**\App.xaml" />
<ApplicationDefinition Include="**\App.xaml" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xaml" Condition="'$(TargetFramework)'=='net461'"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be removed as well. Need to try a WPF netcore 3 sample to make sure

@@ -31,7 +32,7 @@ LibVLC needs to be installed separately, see VideoLAN.LibVLC.* packages.
<ItemGroup>
<ProjectReference Include="..\LibVLCSharp\LibVLCSharp.csproj" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net40'">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Reference can be removed as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry guys.

I did a quick conversion to support netcoreapp3.0.

I should have probably spent more time understanding your build process. I used VS Code / PS Core terminal to compile the project. There are a lot of prerequisite VS 2017/19 payloads which I didn't want to install (UWP, Xamarin, etc).

I was going to update the WPF sample app, but the project is still using old project format.

Let me know if you want me to update the PR and remove the conditional references.

I would love a nuget package targeting netcoreapp3.0 ASAP :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're on VS2017/VS4Mac 2017, but we need to make te migration anyway.
I guess we should make the migration all at once and see if any of the project has incompatibilities.

I might be able to give that a try in the weekend.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened dashkan#2 , but I just noticed Martin already did it...

@vlc-mirrorer vlc-mirrorer merged commit d6dedd0 into videolan:3.x Oct 13, 2019
@mfkl
Copy link
Member

mfkl commented Oct 13, 2019

@dashkan 3.2.4 on nuget contains netcore 3 WPF/WinForms support. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants