codebude / QRCoder

A pure C# Open Source QR Code implementation
MIT License
4.56k stars 1.09k forks source link

Unresolved reference to Mono.Security when merging assembly #127

Closed nitrovent closed 5 years ago

nitrovent commented 6 years ago

Type of issue

[ ] Bug
[x] Question (e.g. about handling/usage)
[x] Request for new feature/improvement

Expected Behavior

I wish to use QRCoder in a project that requires strongly named assemblies. For this purpose and to reduce the number of dll files we have a project that merges all external references and signs the resulting assembly. Merging is done with ILMerge (the resulting assembly contains all the original namespaces).

Current Behavior

When trying to merge the assemblies, ILMerge encounters the reference to Mono.Security in the UnityEngine.dll which is unresolved and thus results in an error when merging.

Possible Solution (optional)

One possible solution would be for us to fork QRCoder and remove the UnityQRCode functionality (which would also reduce the assembly by ~600kB).

Another one would be a breaking change for all that use the unity QRCode: splitting the project into two assemblies, one for core functionality without external dependencies and one for extending the rendering, additional payload generators etc.

Third, finding a solution how to tell ILMerge to ignore the unresolved reference. This kinda works by adding the Unity as a local reference to the project that merges the assemblies and setting 'copy local' to false. But here we're having troubles with our build tasks that we're still evaluating.

My preference would be the second option ;)

Steps to Reproduce (for bugs)

See scenario above

Your Environment

codebude commented 6 years ago

Hi @nitrovent ,

like in #95 this is already on my todo list. I'll split the library in future. But at the moment I'm still unsure, if I'll:

Currently I prefer the first solution, but I'm still unsure.

nitrovent commented 6 years ago

Sounds good. Maybe extract the core functionality into a "light" or "core" package and reference it in the "full" package which is the current package. so there would be no breaking change upon updating this package and people who are happy with judt the core functionality can switch if they like.

codebude commented 5 years ago

Hi @nitrovent, I removed the UnityQRCode.cs/UnityEngine.dll from the main QRCoder project (see https://github.com/codebude/QRCoder/commit/bfd9205e45dce9e0cc460e8c2e8d8cda383b9d83 & https://github.com/codebude/QRCoder/commit/9cc066e4a60be7df0d7aecbbd9011afa57789fd3). From release 1.3.4 on this dependency is gone.

In addition to that I created QRCoder.Unity which contains only the UnityQRCode.cs + NuGet dependencies to the QRCoder and the UnityEngine. I also updated the readme.md and the Wiki.

I hope this solution fit your needs. Feel free to re-open the issue, if there's anything wrong with this solution or anything you like to discuss about.