assembly-signing

How to set assembly version, culture and public key token while compiling with Roslyn?

不羁的心 提交于 2021-02-16 19:22:27
问题 I'm using Roslyn to emit a CSharpCompilation object in Visual Studio to a file. The DLL that is generated does not contain any assembly info other than the assembly metadata, and I'd like to add the version and sign it if possible. How can these be done with Roslyn? 回答1: You need to include source code which sets the Assembly* attributes just like in the VS C# project templates. If you have done that, the .NET version info is set. You can read that information with Reflection or tools like

How to set assembly version, culture and public key token while compiling with Roslyn?

爷,独闯天下 提交于 2021-02-16 19:22:17
问题 I'm using Roslyn to emit a CSharpCompilation object in Visual Studio to a file. The DLL that is generated does not contain any assembly info other than the assembly metadata, and I'd like to add the version and sign it if possible. How can these be done with Roslyn? 回答1: You need to include source code which sets the Assembly* attributes just like in the VS C# project templates. If you have done that, the .NET version info is set. You can read that information with Reflection or tools like

C#: Signing DLL with strong name (what about its dependencies?)

家住魔仙堡 提交于 2020-01-07 02:48:13
问题 A while ago I asked about "DLL caused an exception" when calling a method that references another DLL. On that time I had no clues but now I think what may be causing the problem. Assume I have an EXE calling a DLL1 which requires a DLL2 . When I signed DLL1 with a strong name, for some reason all calls to DLL2 's methods started returning the error below: System.Exception: Error while trying to call method X from DLL1. ---> System.Reflection.TargetInvocationException: Exception has been

How to programmatically verify an assembly is signed with a specific Certificate?

一笑奈何 提交于 2019-12-20 09:53:49
问题 My scenario is we have one program (exe) that will start other programs if found in a particular folder. I want to ensure it only ever starts programs which are signed with our Corporate certificate (Verisign approved etc). Essentially then it will only start the programs with the same certificate as itself. I don't want to ship the certificate itself. I've been searching the web and the system namespace and haven't found a clear example that reads the certificate data from a file and also

Signing of .NET Assemblies

房东的猫 提交于 2019-12-17 22:34:15
问题 What does digital signature have to do with strong named assemblies. I read that a strongly named assembly has public key and digital signature with it. From the Wikipedia article "Assembly (CLI)": "Signing the assembly involves taking a hash of important parts of the assembly and then encrypting the hash with the private key. The signed hash is stored in the assembly along with the public key. The public key will decrypt the signed hash. When the CLR loads a strongly named assembly it will

How to declare a friend assembly?

喜你入骨 提交于 2019-12-17 08:01:53
问题 I have 2 projects in my solution: Assembly (Basic Library) Test Assembly (NUnit) I had declared the test assembly as friends assembly in first project: [assembly: InternalsVisibleTo ("Company.Product.Tests")] Everything was working fine till I realised that I have forgot to setup the solution to sign my assemblies. So created a snk file and setup the visual studio project to sign the first assembly (Basic Library). Now when I compile the first project, I get following error: Friend assembly

Third party DLL does not have 'strong name'?

别等时光非礼了梦想. 提交于 2019-12-10 14:27:41
问题 My Visual Studio 2010 solution references a third party proprietary DLL. When I try to compile the solution the error message reads: Unable to emit assembly: Referenced assembly 'NameOfAssembly.DLL' does not have a strong name Is the only solution to this issue to sign the third party DLL with my own key? 回答1: That's criminal negligence by anybody that creates assemblies used by others, given how trivial it is to give an assembly a strong name while building it. Doing it afterwards is quite

c# - can you make a “weak” assembly reference to a strong named assembly

流过昼夜 提交于 2019-12-10 13:22:37
问题 For various reasons i would rather not use strong named (signed) assemblies in my project. however, one of the projects is referenced by a sharepoint web part which means it must be signed. is it possible to have this assembly signed but when I reference it from other projects, to do so using a non-strong reference. this would give me the advantages of having a non-signed assembly for the rest of my code but still allow it to be loaded by sharepoint. 回答1: The simplest way to do this is

How to get Container name for PFX key?

人盡茶涼 提交于 2019-12-10 10:13:20
问题 Some time ago I installed my PFX key into Container using command like this: sn -i mykey.pfx VS_XXX but two months later I forgot the Container name (VS_XXX), so my question is: How to get than name back? I know key name, I have this key, I know the key pass phrase. 回答1: Download the Keypal utility and double click it, you will find all the names of the key containers. You can choose between user profile and machine profile. Alternatively, enumerate the certificate store to find the

Signing binaries of open-source projects

强颜欢笑 提交于 2019-12-06 18:08:34
问题 I tried to use ServiceStack in my current project but found the binaries released were not strong named so i couldn't use it out of the box. When asking on GitHub "why" I got the following answer: it's virally toxic and hinders binding, upgrading, development, deployment, etc. mythz was very laconic so I didn't want to bother him more and asking here. I use a lot of open-source .NET projects like AutoMapper, NUnit, Moq, log4net, Ninject, etc. and their releases are all strong named. Found