|
| 1 | +Nivot.StrongNaming |
| 2 | +================== |
| 3 | + |
| 4 | +* v1.0.4.1 (something fishy is going on with my package build process?) |
| 5 | +* v1.0.4 (fix missing mono.cecil) |
| 6 | +* v1.0.3.2 (fix package: second attempt; readme.txt auto-open) |
| 7 | +* v1.0.3.1 (fix package) |
| 8 | +* v1.0.3 [2014/01/26] |
| 9 | + * Assembly references without a strongname will be given a strong name using the same |
| 10 | + public key token as the primary target assembly. |
| 11 | +* v1.0.2 [2013/04/30] |
| 12 | + * Added license and project URL. |
| 13 | + * Added readme.MD |
| 14 | +* v1.0.1 [2013/04/29] |
| 15 | + * Updated metadata. |
| 16 | +* v1.0.0 [2013/04/29] |
| 17 | + * Initial release. |
| 18 | + |
| 19 | +Details |
| 20 | +======= |
| 21 | + |
| 22 | +All cmdlets accept pipeline input. The AssemblyFile parameter is aliased to PSPath, so it will |
| 23 | +bind to piped files. |
| 24 | + |
| 25 | +* Test-StrongName [-AssemblyFile] <string[]> [<CommonParameters>] |
| 26 | + |
| 27 | + Returns true if an assembly has a strong name. |
| 28 | + |
| 29 | +* Import-StrongNameKeyPair [-KeyFile] <string> [<CommonParameters>] |
| 30 | +* Import-StrongNameKeyPair [-KeyFile] <string> -Password <securestring> [<CommonParameters>] |
| 31 | + |
| 32 | + Imports a simple unprotected SNK or a password-protected PFX, returning a StrongNameKeyPair |
| 33 | + instance for consumption by Set-StrongName. If your PFX file has a blank password, you must |
| 34 | + provide a SecureString of the empty string "". SecureString instances are returned from |
| 35 | + the Read-Host cmdlet with the -AsSecureString parameter. |
| 36 | + |
| 37 | +* Set-StrongName [-AssemblyFile] <string[]> -KeyPair <StrongNameKeyPair> [-NoBackup] [-Passthru] |
| 38 | + [-Force] [-DelaySign] [-WhatIf] [-Confirm] [<CommonParameters>] |
| 39 | + |
| 40 | + Assigns a strong name identity to an assembly. |
| 41 | + |
| 42 | + The -KeyPair parameter accepts a System.Reflection.StrongNameKeyPair output from the |
| 43 | + Import-StrongNameKeyPair cmdlet., which accepts either simple unprotected SNK files or |
| 44 | + password-protected PFX files. |
| 45 | + |
| 46 | + The -NoBackup switch directs the cmdlet to skip creating a .bak file alongside the newly |
| 47 | + signed assembly. |
| 48 | + |
| 49 | + The -Passthru switch will output a FileInfo representing the newly signed assembly to |
| 50 | + the pipeline. |
| 51 | + |
| 52 | + The -DelaySign switch will create a delay-signed assembly from a public key only SNK |
| 53 | + (it can also create one if the SNK contains both private and public keys.) This is useful |
| 54 | + if you can't get access to the full private key at your company. This will allow you to |
| 55 | + compile against previously unsigned nuget packages at least. |
| 56 | + |
| 57 | + The -Force switch will allow you to overwrite an existing strong name on an assembly. |
| 58 | + |
| 59 | + NOTE: You may supply -WhatIf to see what _would_ be done, without actually doing it. |
| 60 | + |
| 61 | +* Get-AssemblyName [-AssemblyFile] <string[]> [<CommonParameters>] |
| 62 | + |
| 63 | + Returns a System.Reflection.AssemblyName instance from any assembly file. |
| 64 | + |
| 65 | +FAQ: How Do I? |
| 66 | +============== |
| 67 | + |
| 68 | +# get the default package root folder |
| 69 | +PM> $root = join-path (split-path $dte.solution.filename) packages |
| 70 | + |
| 71 | +# load an unprotected snk |
| 72 | +PM> $key = Import-StrongNameKeyPair -KeyFile .\folder\key.snk |
| 73 | +PM> dir *.dll | Set-StrongName -KeyPair $key -Verbose |
| 74 | + |
| 75 | +# load a password-protected PFX |
| 76 | +PM> $key = Import-StrongNameKeyPair -KeyFile .\folder\key.pfx -Password (Read-Host -AsSecureString) |
| 77 | +****** |
| 78 | + |
| 79 | +# sign some unsigned assemblies |
| 80 | +PM> cd (join-path $root unsignedPackage) |
| 81 | +PM> dir -rec *.dll | set-strongname -keypair $key -verbose |
| 82 | + |
| 83 | +# (re)sign some assemblies forcefully |
| 84 | +PM> dir -rec *.dll | set-strongname -keypair $key -force |
| 85 | + |
| 86 | +# sign only unsigned assemblies |
| 87 | +PM> dir -rec *.dll | where { -not (test-strongname $_) } | set-strongname -keypair $key -verbose |
0 commit comments