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

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
  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.


Comments (8)

  1. Bob says:

    I always wondered what the easiest way to do this was.  Good tip!

  2. Doug says:

    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.

  3. @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. 🙂


  4. Martin says:

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

  5. rospy7 says:

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

  6. Liz Elizondo says:

    This is awesome! Thanks for sharing!

  7. Olly A says:

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

  8. Sam says:

    Do it right or do not it!

    the argument is WRONG