Comments (3)
Hi! Thanks for pointing this out, I didn't realise strong naming was still around (I have been using mostly .NET Core/.NET, and strong naming doesn't really matter anymore). Assuming it won't break anything, I will try to strong name-sign the next release!
In the meantime, assuming you don't want to disable strong naming in your project, you don't need to build from source; you can use the following workaround:
-
Uninstall the MuPDFCore NuGet package from your project.
-
Download the MuPDFCore nupkg file, rename it to have a
.zip
extension and extract it somewhere. -
Now, you need to sign the DLL to give it a strong name. I assume you have a
.snk
file that you have been using to sign your project:-
Open the
Developer Command Prompt
that is installed with Visual Studio and double-check that you have theilasm
,ildasm
andsn
tools. -
Use
cd
to change directory to the extractednupkg
file. -
Execute:
sn -vf lib\netstandard2.0\MuPDFCore.dll
This should show a message saying
lib\netstandard2.0\MuPDFCore.dll does not represent a strongly named assembly
- just to confirm what we're working with. -
Run:
ildasm /all /out=lib\netstandard2.0\MuPDFCore.il lib\netstandard2.0\MuPDFCore.dll
This will disassemble the MuPDFCore DLL and produce a file called
MuPDFCore.il
(containing the disassembled code) and another file calledMuPDFCore.res
(containing the resources) in thelib\netstandard2.0
folder. -
Unfortunately, the
ilasm
tool has a bug when dealing withNaN
s, so we need to make a small change in the IL file. Open theMuPDFCore.il
file in a text editor, and replace every occurrence ofldc.r8 -nan(ind)
withldc.r8 (00 00 00 00 00 00 F8 FF)
. There should be 10 occurrences. Save and close. -
You can now rebuild the DLL signing it with the strong name key with this command:
ilasm /dll /key=path\to\key.snk /resource=lib\netstandard2.0\MuPDFCore.res lib\netstandard2.0\MuPDFCore.il
This will overwrite the
lib\netstandard2.0\MuPDFCore.dll
library with the signed one.- If you now execute:
This should show a message saying
sn -vf lib\netstandard2.0\MuPDFCore.dll
Assembly 'lib\netstandard2.0\MuPDFCore.dll' is valid
, confirming that everything has worked.
-
-
You can finally add the reference back into the project. In Visual Studio, add a reference to the signed
MuPDFCore.dll
. -
Finally, right click on the project in the
Solution Explorer
and selectAdd > Existing item...
. Locate and select theMuPDFWrapper.dll
file for your architecture (if you're building for Any CPU or x86, select theMuPDFWrapper.dll
file in theruntimes\win-x86\native
folder within the extracted NuGet package, if you're building for x64 select instead the one inruntimes\win-x64\native
). After adding the item to the project, set theCopy to Output Directory
action toCopy if newer
in the file properties.
You should now be able to debug and execute your program.
I hope this makes sense, let me know if something isn't clear or if you have any further questions!
from mupdfcore.
Hi,
Thank you very much for the information.
Issue resolved.
Best Regards
Wicky
from mupdfcore.
Hi, starting from the new version 1.8.0, the library is now strong-name signed.
I'm closing this issue, let me know if you have any more problems!
from mupdfcore.
Related Issues (20)
- If MuPdfWrapper.dll can work in 32-bit windows HOT 8
- How to improve or decrease png quality? HOT 3
- .dll problem when released HOT 3
- Method not found: 'Void MuPDFCore.MuPDFContext..ctor(Int64)'. HOT 2
- Cannot open document HOT 5
- Other output image formats HOT 3
- Accept and return ReadOnlySpan<byte> instead of IntPtr HOT 3
- do you support reading encrypted PDF files? HOT 3
- Install MuPDFCore in Blazor WebAssembly HOT 4
- PDFViewerDemo cannot chanage pages HOT 2
- show pdf files continuously HOT 1
- Don't work with musl-based linux distros HOT 2
- blank area above PDFRender
- using MuPDFRenderer control on Avalonia 11 HOT 3
- Set anti-aliasing level HOT 2
- Is there a way to support iOS and Mac Catalyst? HOT 1
- is there a plan to support the outline HOT 3
- Do you support deleting pages HOT 1
- How to extract font name, font binary data, font 2D coordinates, image binary data, image 2D coordinates within a PDF page?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mupdfcore.