Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add strong naming support for netstandard #803

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SimonCropp
Copy link
Contributor

No description provided.

@SimonCropp
Copy link
Contributor Author

@jbevain can this get some love. happy to pay you to look into it

@jbevain
Copy link
Owner

jbevain commented Nov 8, 2021

@SimonCropp thank you as always for the PR. I'm in a bit of an intense period at work and have been lagging behind a bit on the last few new Issues and PRs. I'll get to them asap.

@atlemann
Copy link

It would be awesome if this got fixed/merged. We've just got blocked by this as well when we removed net472 targets from our assemblies and only target netstandard2.0.

@jbevain
Copy link
Owner

jbevain commented Jan 13, 2022

Hi folks, sorry it took a while to get to, thankfully I should have more time in the new year :)

@SimonCropp somehow I'm not super excited at the idea of providing an API with a similar name as in the .NET Framework, even if it's only included on net standard builds. For instance, if you're referencing a Cecil built for netstandard in a .NET 4.x application you'll need to fully qualify StrongNameKeyPair because you'll see both, no?

We've added WriterParameters.StrongNameKeyBlob for the scenarios where StrongNameKeyPair is not available.

I understand that pushes the responsibility of using one or the other to the user instead of having this Cecil directly which is not great.

Maybe we could take this and move StrongNameKeyPair to a namespace like Mono.Security.Cryptography so that if you want to use our StrongNameKeyPair this is explicit and not part of the full Mono.Cecil namespace?

@atlemann
Copy link

atlemann commented Feb 4, 2022

Could it use only the internal StrongNameKeyPair for both .NET 4.x and netstandard?

@SimonCropp
Copy link
Contributor Author

@jbevain done

Comment on lines +16 to +20
#if (NETSTANDARD)
using StrongNameKeyPair=Mono.Security.Cryptography.StrongNameKeyPair;
#else
using StrongNameKeyPair=System.Reflection.StrongNameKeyPair;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates a different and incompatible API shape between the .NET Framework and .NET Standard editions of Cecil and will break if an assembly compiled with the former uses the latter at runtime (a totally possible and supported scenario).

I had started and abandoned work on a compatible design that would solve this problem. It can be found in https://github.com/teo-tsirpanis/cecil/tree/strong-name-key-pair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants