MP3Sharp
MP3Sharp copied to clipboard
Add multiple target frameworks
Hello again @ZaneDubya !
What I am trying to do here:
- Integrate MP3Sharp into https://github.com/andreakarasho/ClassicUO as an external library, to get bugfixes and all the hard work you have done here :)
- Build ClassicUO with net50 as the targeted framework, without installing any other SDKs
Not installing other SDKs is a requirement mainly for Linux build and an automated release build, both have a bit more complicated access to older framework versions. Automated build runs in the GitHub workflow and installing net40 framework there becomes quite messy.
This project file update should make it possible for this library to build against multiple different framework versions. I am not trying to mess up any build processes that you have going on, so let me know if this doesn't work for you.
I tested ClassicUO build with the updated project file on Linux and on Windows, and it seems to work okay.
AssemblyInfo.cs seems to be redundant with the Microsoft.NET.Sdk
and caused compilation problems, so I removed it. I moved the Title and Product fields from it to the project file.
Very interesting!
Did you test and make sure that it still compiles as the old framework version in addition to your new version?
If that doesn't work, perhaps multiple project files might be needed.
Very interesting!
Did you test and make sure that it still compiles as the old framework version in addition to your new version?
If that doesn't work, perhaps multiple project files might be needed.
On Windows, building the library produces 3 different dll's. This is the build output:
Build started...
1>------ Build started: Project: MP3Sharp, Configuration: Debug Any CPU ------
1>MP3Sharp -> C:\Users\samuliy\Documents\Git\MP3Sharp\MP3Sharp\bin\Debug\net40\MP3Sharp.dll
1>MP3Sharp -> C:\Users\samuliy\Documents\Git\MP3Sharp\MP3Sharp\bin\Debug\net472\MP3Sharp.dll
1>MP3Sharp -> C:\Users\samuliy\Documents\Git\MP3Sharp\MP3Sharp\bin\Debug\net50\MP3Sharp.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
So it seems that you can just pick the matching library file for your project's framework version.
Adding to the previous reply. Got time to set up the XNA4Sample project that comes with the repository and it seems to build successfully.
Installed XNA Game Studio for VS2019 and here is the output:
Build started...
1>------ Build started: Project: XNA4Sample, Configuration: Debug x86 ------
1> XNA4Sample -> C:\Users\samuliy\Documents\Git\MP3Sharp\XNA4Sample\bin\x86\Debug\XNA4Sample.exe
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
The executable runs and plays music. The XNA4Sample project is set to v4.0 framework version, so everything seems to be okay backwards-compatibility-wise.
After a while I decided that it's better to create a new .csproj
file. Targeting a .NET Standard seems like the best way to go with a project targeting multiple frameworks. Using .NET standard might or might not bring issues when using old framework versions like 4.0, so better just try to avoid all the hassle that comes with editing the original .csproj
.
I reverted the commits I made previously and added a new file that can be linked to a project using newer framework versions. This seems to work better for my use case.
Thanks @samuliy! I agree, that's a better way to go. My non-programming job still has me swamped. I will get around to looking at this. :)
Thanks for the reply. We are now currently using the fork for the ClassicUO build process, so there is no real hurry on this. I will point the submodule in ClassicUO into this project if we get this merged :)