LibVLCSharp issueshttps://code.videolan.org/videolan/LibVLCSharp/-/issues2024-03-04T10:10:35Zhttps://code.videolan.org/videolan/LibVLCSharp/-/issues/635Build errors when targeting Windows SDK versions2024-03-04T10:10:35ZBarrett LewisBuild errors when targeting Windows SDK versions### Summary
Including LibVLCSharp in an x86/64 project with a **versioned** windows sdk `<TargetFramework>`, along with windows forms enabled, causes the following errors:
```
Error NETSDK1082 There was no runtime pack for Microsoft.Wi...### Summary
Including LibVLCSharp in an x86/64 project with a **versioned** windows sdk `<TargetFramework>`, along with windows forms enabled, causes the following errors:
```
Error NETSDK1082 There was no runtime pack for Microsoft.WindowsDesktop.App.WindowsForms available for the specified RuntimeIdentifier 'win10-arm-aot'.
Error NETSDK1082 There was no runtime pack for Microsoft.WindowsDesktop.App.WindowsForms available for the specified RuntimeIdentifier 'win10-arm'.
```
When ARM is not used or referenced in the project.
Specifically, I have found that there is a combination of 3 things, that when are the case together, lead to the errors:
1. LibVLCSharp (3.8.2, and some previous) is loaded in the project through Nuget
2. Target framework is _net6.0-windows10.0.19041.0_ (or _net6.0-windows10.0.17763_).
3. `<UseWindowsForms>true</UseWindowsForms>` in the csproj.
If (only) any two of the three is the case, the build succeeds:
- LibVLCSharp works with the desired target framework, until UseWindowsForms is added.
- LibVLCSharp works with UseWindowsForms on _net6.0-windows_, until it's changed to _net6.0-windows10.0.XYZ_.
- The desired target framework works with UseWindowsForms, until LibVLCSharp is added.
It seems that the LibVLCSharp package has some kind of msbuild target setup for this combination of factors that requires an arm runtime/workload installed
Adding `<RuntimeIdentifier>win-x64</RuntimeIdentifier>` does not resolve the issue.
I have tried multiple build environments with the same results.
I primarily work in windows/x86 and troubleshooting cross platform build configurations is not my forte, or I would try to dig deeper.
### Minimal project and steps to reproduce
Start with a blank project with arbitrary main() boilerplate.
- Add LibVLCSharp
- Enable windows forms
- Use a versioned windows SDK target framework
- Try to build.
Sample:
https://code.videolan.org/BarrettLewis/build-issue
NOTE: I started with a functional application using LibVLC (and company), encountered this error when switching target frameworks, and then stripped it down to 10 lines of csproj to repro the issue, that is why other packages like VideoLAN.LibVLC.Windows, LibVLC.Forms, etc, are not linked. This is the bare minimum to get the error.
Functionality can be toggled by (for example) removing the csproj line to enable windows forms. In my case I have to close VS, clear the `bin` and `obj` folders and restart vs. Then it will build until the missing piece of the unholy trinity is added back.
### What is the current *bug* behavior?
Build fails, complaining about missing ARM workload which is not being used.
### What is the expected *correct* behavior?
Build succeeds, does not require ARM workload to build x86/64
### Environment
<!-- Please complete the following information. -->
- OS: Windows
- Version 10 21H2
- Device: PC
- LibVLC version and architecture 3.0.20 (doesn't matter)
- LibVLCSharp version 3.8.2, x64 (desired)
- Visual Studio 2022 17.8.3
- MSBuild version 17.8.3