Closed ShemJM closed 5 years ago
Are you using a Sdk-style vbproj format or a legacy format? I think that we only support SDK-style project files, or at least only the new PackageReference system (and not the packages.config file). Can you send us a project reproducing the issue on a github repository?
I haven't been able to replicate the exact same problem. I have made this very quickly but this does not exclude the files I have set in the project file.
I am very sure that I am doing this wrong. I created the app, used Nuget package manager to get libvlc and dotnet.vlc.forms then I added the lines into the project file and built the solution. It just ignores my lines and adds everything to the debug folder.
I guess I am using legacy style if I have a packages config file.
I really only need the files for streaming a rtsp feed, so no sound, gui or anything else.
https://github.com/ShemJM/WindowsApp1/tree/master/WindowsApp1
Your PropertyGroup and ItemGroup sections must be directly under the <Project>
tag, not under the <Target>
.
Yes, you are using the legacy project format, but maybe that will work anyway. Just keep in mind that VisualStudio does what it wants in that files. I guess that it's what happened, it replaced the target content with what it read from the packages.
I have migrated to a package reference style. It seems to be working better because the exclude/include lines are not being removed. The problem is that when I load my project the files mentioned in those lines whether they are excluded or included are being placed in to my solution explorer.
<ItemGroup>
<VlcWindowsX86IncludeFiles Include="libvlc.dll;libvlccore.dll" />
</ItemGroup>
UPDATE:
Just after writing this message, I reloaded the project and the lines were gone. It seems if I delete the files from the solution explorer, the lines are removed from the project file.
If you remove them from Visual studio, of course it does remove the lines in your project file.
However, those file should not appear in your solution explorer and I'm still wondering why they do...
EDIT: Please update your github repo so that we can try locally.
I have made this repo where the same issue is occurring.
https://github.com/ShemJM/WindowsApp1
It is just an example project because the project I am working on where I had the original issue is not public. I am not sure how helpful the repo will be. Perhaps it would be easier to follow my steps and see if you experience the same issue.
I should add that my app is working I can use the vlc control to play videos. I just want to cherry pick the files so I can get the install size down.
It seems that because you are not using the SDK-style projects, VS displays the items this way.
Can you try wrapping your ItemGroup in a
<Target Name="LibVlcWindowsCherryPick" BeforeTargets="CollectVlcFilesToCopyWindows">
</Target>
That should work. (note: you can pick whatever Name you want, but don't touch the BeforeTargets, it's defined here https://github.com/mfkl/libvlc-nuget/blob/ff6474f9505a0012f7ef5da80866a7429bd55902/build/VideoLAN.LibVLC.Windows.targets#L16 )
Yes, that works, thank you.
<Target Name="LibVlcWindowsCherryPick" BeforeTargets="CollectVlcFilesToCopyWindows">
<ItemGroup>
<VlcWindowsX86ExcludeFiles Include="hrtfs\%2A%2A;
lua\%2A%2A;
locale\%2A%2A;
plugins\audio_filter\%2A;
plugins\audio_mixer\%2A;
plugins\audio_output\%2A;
plugins\access_output\%2A;
plugins\control\%2A;
plugins\d3d9\%2A;
plugins\d3d11\%2A;
plugins\demux\%2A;
plugins\gui\%2A;
plugins\keystore\%2A;
plugins\logger\%2A;
plugins\lua\%2A;
plugins\meta_engine\%2A;
plugins\mux\%2A;
plugins\text_renderer\%2A;
plugins\visualization\%2A;
plugins\video_chroma\%2A;
" />
</ItemGroup>
</Target>
Feel free to close this if you got your question answered ;-)
plugins\d3d11\%2A;
I wouldn't recommend you to disable those, you won't get any hw acceleration if you do
plugins\demux\%2A;
Did you test that one? I'm not sure that would work without any demuxer.
plugins\access_output\%2A;
I had crashes if I didn't include at least mmdevice on windows... don't know if this has been fixed since then.
I am only using this for a rtsp stream from our IP cameras. It seems to work fine without those files. I don't know much about the different options. I was just trying to use the bare minimum because by adding LibVLC my project size has gone from 12MB to 63MB. That is after cherry picking because at first it was 320MB.
I think you can shrink it further by including only what you need. in codec, you could try with only libavcodec... you will also probably need only rtsp and rtp access.
but I would keep d3d libs for hardware acceleration
I was going to ask for advice on how to shrink it further, so thank you again. I will try without those.
Sorry, one more question. I have managed to find the small amount of files I actually need. Is there a way for me to just write lines to include those rather than lines that exclude everything else?
Yes, that was what I suggested : https://github.com/mfkl/libvlc-nuget/blob/master/cherry-picking.md#cherry-pick-the-files-you-need
I did try an inclusive strategy but it just included every file. That is why I moved to exclusive.
That shouldn't be, please share a sample
Well I just copied from your example
<Target Name="LibVlcWindowsCherryPick" BeforeTargets="CollectVlcFilesToCopyWindows">
<ItemGroup>
<VlcWindowsX86IncludeFiles Include="libvlc.dll" />
</ItemGroup>
</Target>
Something like that, but that would include every file still
Use
<Target Name="LibVlcWindowsCherryPick" BeforeTargets="CollectVlcFilesToCopyWindows">
<ItemGroup>
<VlcWindowsX86IncludeFiles Remove="@(VlcWindowsX86IncludeFiles)" />
<VlcWindowsX86IncludeFiles Include="libvlc.dll" />
</ItemGroup>
</Target>
Since you are using a target, your "Include" adds an item to the list that has already populated here : https://github.com/mfkl/libvlc-nuget/blob/ff6474f9505a0012f7ef5da80866a7429bd55902/build/VideoLAN.LibVLC.Windows.targets#L13
You thus need to remove the default items.
I see, that makes sense. I will try it out tomorrow when I am at work. Thanks again :D
Works perfectly.
I have followed the guide on cherry picking which files I want to keep. When I load the project, the files I have chosen are in the solution explorer, which I think is not supposed to happen. Then when I build the project the include/exclude lines are removed from my project file.
The other libvlc lines stay in place, the one where I disable the x64 files for example.
I am working on a Visual Basic Winforms app, using libvlc and the dotnet.vlc.forms packages.