com - Signing an F# Assembly (Strong name component) -


i found article on codeproject: http://www.codeproject.com/articles/512956/net-shell-extensions-shell-context-menus

and thought nice give try, in f#. came following code:

open system open system.io open system.text open system.runtime.interopservices open system.windows.forms open sharpshell open sharpshell.attributes open sharpshell.sharpcontextmenu  [<comvisible(true)>] [<comserverassociation(associationtype.classofextension, ".txt")>] type countlinesextension() =     inherit sharpcontextmenu.sharpcontextmenu()      let countlines =         let builder = new stringbuilder()                      base.selecteditempaths |> seq.iter (fun x -> builder.appendline(sprintf "%s - %d lines" (path.getfilename(x)) (file.readalllines(x).length)) |> ignore  )             messagebox.show(builder.tostring()) |> ignore      let createmenu =         let menu = new contextmenustrip()         let itemcountlines = new toolstripmenuitem(text = "count lines")                     itemcountlines.click.add (fun _ -> countlines)             menu.items.add(itemcountlines) |> ignore         menu      override this.canshowmenu() = true     override this.createmenu() = createmenu 

however, noticed there no support signing f# assembly in vs2012 (step 4. in article). learnt if want so, need create key manually (typing "sn -k keyname.snk" command prompt) , add flag in "project properties -> build -> other flags" (--keyfile:keyname.snk).

i still didn't manage run this. moreover, using author's application (in "debugging shell extension" section) error assembly doesn't contain com server.

i believe i'm doing wrong signing component. me in running ?

one way sign f# assembly via assemblyfilekeyattribute attribute.

create new module , in put:

module assemblyproperties  open system open system.reflection; open system.runtime.interopservices;  [<assembly:assemblykeyfileattribute("mykey.snk")>]  do() 

where "mykey.snk" path key relative project directory.

another way, found in bug report on microsoft connect, add --keyfile:mykey.snk other flags field in properties --> build tab.

using either approach; running sn -v myfsharpassembly.dll assert assembly valid after compilation.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -