-
Notifications
You must be signed in to change notification settings - Fork 28
Issues with full Framework build #33
Comments
Did you encounter the same behaviour when evaluating my fork? (context: I created MozJpegSharp, which is a fork of this repo that uses MozJPEG and comes with prebuilt binaries too. @0shi opened an issue at MozJpegSharp, which is why I know he tried it.) When I do a short test
I observe that I get a System.TypeInitializationException with Quamotion.TurboJpegWrapper (details below) but it works fine with MozJpegSharp. Thus, I assume that some of my changes fixed this issue. Maybe I'm able to help fixing it here too. Afaik (sadly I don't have a link right now) native binaries are copied automatically from NuGet packages for SDK-style projects but not for older ones. To overcome this issue I took some inspiration from SQLitePCL.raw, which has to handle this too and is very broadly used (i.e. as base of EF Core SQLite) and seems very carefully maintained. As a result I created MozJpegSharp.targets, that becomes part of the final nuget package and contains instructions for copying the files around (I liked NuGetPackageExplorer for taking a look). To summarize, I think adding an appropriate Exception details:
Working directory structure using MozJpegSharp (see also here)
|
@georg-jung - Thanks for confirming a repro! I did not experience this with your fork. If it helps I have a few sample projects which can easily produce the issue, but you should be able to just create a .NET Framework console application from the template (To test with old .CSPROJ style) or create a new .NET Core console application from the template and change the target framework (To test with the new .CSPROJ style) |
@georg-jung - Unfortunately I spoke a little too soon. It seems that I tried a few common methods for resolving dlls in this context and wasn't able to get anything useful:
I finally found some success with If this isn't suitable, not sure how to get around this without letting users override the importer. Again, I can work around this by copying the folders to the correct place manually, but now that correct place is our Project folder rather than a bin folder, which isn't desirable. My workaround would be to add those folders to .gitignore and copy them there as a build step. EDIT: In case anyone else needs the build steps I'm using:
|
Thanks for all the research! I somehow got the feeling there needs to be an easier solution to this. I mean, it can't be the intention of the framework authors that every .Net Standard lib author who consumes native code has to juggle with paths in this way. Maybe it just got that hard because we started thinking about paths in the first place. I'll look into it... |
While looking at the solutions other projects took, I came across multiple approaches. I started summarizing what I found, but it's still very much a WIP. I'll post my notes here though a) to keep them in the right place and b) because they might give some starting points if someone else looks for this: For anything that's not .Net Core 3+, there does not seem to be the way to go.
Left to do for me:
|
Also experiencing this issue after upgrade |
I tried creating the folder |
You could try placing the You can also try installing MozJpegSharp (which is based on this project; disclaimer: I created it) and see if that works. If it does you can look at the build output that is created while it is installed and replicate that manually when switching back to this package. |
I found the file
|
Hi there,
I've been evaluating a couple of MozJpeg / LibJpeg libraries for some post-processing work, and had some issues getting the full Framework (I've tried in console applications with net45 and net471) build working locally. I encountered the following issues:
The dlls are not copied from the packages folder into the bin folder as part of a build unless you are using both a new style .csproj AND you have included a RuntimeIdentifier in the csproj. This does, however, work regardless of your values for AppendTargetFrameworkToOutputPath and AppendRuntimeIdentifierToOutputPath.
The dlls cannot be read from the location they are copied to using the existing code. This is because they look in a subfolder for the dll, rather than in the root, as you can see here:
AS.TurboJpegWrapper/Quamotion.TurboJpegWrapper/TurboJpegImport.cs
Line 125 in f754900
This appears to fail because
AppDomain.CurrentDomain.SetupInformation.ApplicationBase
already includes the RuntimeIdentifier portion of the path, and it does not need to be appended again (Meanwhile, the dll is now located in the folder located byAppDomain.CurrentDomain.SetupInformation.ApplicationBase
).I've worked around this issue by creating those folders manually and pasting the dlls into them as part of my build process, so this is not a blocker.
Thanks!
The text was updated successfully, but these errors were encountered: