Microsoft SharePoint Developer Documentation Team Blog
The Official Blog of the SharePoint Developer Documentation Team

Quick Tip: Find the Four-Part Name for an Assembly

Quick Tip: Find the Four-Part Name for an Assembly

  • Comments 8

When developing for SharePoint, you sometimes need to find the four-part name for an assembly. You can do this inside of Visual Studio 2010 using PowerShell. It’s pretty straight-forward.

  1. In the Tools menu of Visual Studio, click External Tools.
    Tools Menu
  2. In the dialog, click Add to get a new tool.
    External Tools Menu
  3. Now, configure the tool with the following options:
    Title: Get Four-Part Name
    Command: powershell.exe
    Arguments: –command "[System.Reflection.AssemblyName]::GetAssemblyName(\"$(TargetPath)\").FullName
    Use Output window: Checked
    image
  4. Click OK to dismiss the window.

Now, you can go into the Tools menu to see your tool. If you click it, it will print out the four-part name including the public key token in your Output window.

image

Leave a Comment
  • Please add 8 and 7 and type the answer here:
  • Post
  • I always wondered what the easiest way to do this was.  Good tip!

  • Works beautifully.  I keep getting "null" for my PublicKeyToken however.  I'm new to developing for Sharepoint, could you point me in the right direction?

    Thanks for the great tip.

  • @Bob, I'm glad you enjoyed the tip! Keep an eye out for more tips in the future.

    @Doug, have you built the project? It may not have a DLL to run the command against, so you'll get null back.

    Also, make sure you update your bookmarks to blogs.msdn.com/.../sharepointdev for our new blog! You'll see more tips about SharePoint development there. :)

    -Dallas

  • To get around the "wordwrap" just change the size of your cmd prompt window defaults to 132 characters.

  • nice one, thanx! and Martin, also thanx for the wordwrap tip

  • This is awesome! Thanks for sharing!

  • Awesome!  Why oh why isn't this built in to Visual Studio?

  • Do it right or do not it!

    the argument is WRONG

Page 1 of 1 (8 items)