This tip will make it easy for you to get that assembly name right within Visual Studio.
This applies to both SP2010 and SP2007.
- In Visual Studio, Go to Tools –> External Tools.
- Click on “Add” to add a tool, and put in the following values:
- Title: S&trong Name
- Command: Powershell.exe
- Arguments: -command "[System.Reflection.AssemblyName]::GetAssemblyName(\"$(TargetPath)\").FullName"
- Check “Use Output Window”
- Uncheck everything else – here’s how it should look -
3. That’s it, now in your project, Visit Tools –> Strong Name, and in the output window, itwill give you the assembly name like this –>
SandBoxWebPartWithProxy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=64b818b3ff69ccfa
On
12/6/2009 10:29:54 PM
Harish Mathanan
said ..
Nice tip! thanks Sahil :)
|
On
2/23/2010 1:02:43 AM
Venkatesh
said ..
Hi,
In the command, when i give "Powershell.exe", I am getting error as "Command is not a valid executable".. How to correct this?
Thank you
|
On
7/18/2010 1:44:55 PM
Andrew Vevers
said ..
Hello
I am getting the error:
Exception calling "GetAssemblyName" with "1" argument(s): "The path is not of a
legal form."
At line:1 char:50
+ [System.Reflection.AssemblyName]::GetAssemblyName <<<< ("").FullName
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
- any ideas?
Am using it against a SharePoint 2010 solution.
Regards
Andrew
|
On
7/18/2010 10:12:12 PM
Sahil Malik
said ..
Is your project built yet Andrew?
|
On
8/13/2010 6:42:05 AM
Vivek Soni
said ..
Thanks Sahil for this nice tip!
|
On
9/9/2010 1:56:44 PM
David
said ..
Thank you!! This tip just saved my first production Sharepoint 2010 box from getting airborne ;-)
|
On
1/12/2011 1:22:18 PM
David Smith
said ..
I had the same error as Andrew . I had to restart VS2010.
|
On
1/24/2011 3:50:45 PM
Nimesh
said ..
Getting the following error when try to use the StrongName option for a WCF service
Exception calling "GetAssemblyName" with "1" argument(s): "Could not load file
or assembly 'C:\Users\nmarker\Documents\Visual Studio 2010\Projects\CPUMonitor\
CPUMonSVCLib\obj\Debug\CPUMonSVCLib.dll' or one of its dependencies. This assem
bly is built by a runtime newer than the currently loaded runtime and cannot be
loaded."
At line:1 char:50
+ [System.Reflection.AssemblyName]::GetAssemblyName <<<< ("C:\Users\nmarker\Doc
uments\Visual Studio 2010\Projects\CPUMonitor\CPUMonSVCLib\obj\Debug\CPUMonSVCL
ib.dll").FullName
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Any thoughts?
|
On
12/7/2011 10:58:40 AM
Stephen
said ..
I kept getting errors. Make sure you ar ebuilding against .Net 3.5 and not 4!
|