Registering Add-In in Visual Studio 2005

  • Thread starter Johnny Jörgensen
  • Start date
J

Johnny Jörgensen

Hi

I've created an add-in for VS2005, and it works fine on my development
machine. Now I want to deploy it to another machine, and I can't find out
how to register it. I read the following article on MSDN:

http://msdn2.microsoft.com/en-us/library/19dax6cz(VS.80).aspx

There it says:

************* Start quote ******************

In Visual Studio .NET 2002 and Visual Studio .NET 2003, you were required to
register add-in assemblies with Windows as COM components by using the
Assembly Registration Tool (regasm.exe). Also, you were required to register
the add-in with Visual Studio by using keys in the Windows registry before
the add-in would appear in the Add-In Manager.
These steps have changed in Visual Studio 2005. You no longer need to
register the .NET assemblies with Windows by using regasm. Instead, you
simply place the assembly .DLL file into a specific directory (described
later in this topic) along with an XML file that has an .Addin file
extension. This XML file describes the information that Visual Studio
requires to display the add-in in the Add-In Manager. When Visual Studio
starts, it looks in the .Addin File location (listed below) for any
available .Addin files. If it finds any, it reads the XML file and provides
the Add-In Manager with the information needed to start the add-in when it
is clicked.
This simplified registration method allows XCopy-style installations for
managed code add-ins. If you put all the files in the right place, then your
add-in works just fine. Also, its use of commented XML to define the
registration settings for add-ins allows the information to be more easily
understood and edited than registry keys.
The .Addin File
A new XML file with the extension, .Addin, replaces the old add-in registry
settings. Two copies of the .Addin file are automatically created upon
completion of the Add-In Wizard:
..Addin File location .DLL File Location Description
Addin folder
(for example, \Documents and Settings\All Users\My Documents\Visual Studio
2005\Addins)
-or-
\Documents and Settings\<user name>\My Documents\Visual Studio
2005\Addins)Project debug folder
(for example, \My Documents\Visual Studio
Projects\MyAddin1\MyAddin1\bin)Used for running the add-in in the debugging
environment. Should always point to the output path of the current build
configuration.
Root project folder
(for example, \My Documents\Visual Studio\Projects\MyAddin1)Local path
(MyAddin1.dll)Used for deployment of the add-in project. It is included in
the project for ease of editing and is set up with the local path for
XCopy-style deployment.

************* End quote ******************

But I don't get this. It can't be true that another user of my add-in has to
have a folder in HIS projects folder containing the add-in! And it doesn't
work anyway.

From what I understand of the text above, it suffices having a .Addin
XML-file, but no matter if I put it in "MyDocuments\Visual Studio
2005\Addins", "MyDocuments\Visual Studio 2005\Addins\MyAddInName" or
"MyDocuments\Visual Studio 2005\Projects\MyAddInName" on the target machine,
Visual Studio doesn't seem to find it.

What am I missing?

Cheers,
Johnny J.
 
J

Johnny Jörgensen

OK, sorry - I got it to work now.

However, I'm having trouble replacing the default AboutBoxIcon assigned by
Visual Studio. As you know, it's placed in binary data form in the .AddIn
XML file.

According to the article mentioned below, you can replace the binary data
with the fully qualified path to an .ico file.

That doesn't work. If I do that there is no icon shown.

On the other hand, I would also rather that I don't have to give the fully
qualified path to the icon (meaning that I have to edit the .Addin file in
the deployment phase. I could just exchange the binary data for the icon.

But then the question is: How do you convert an .ico file to binary data
that you can paste into the .Addin file?

Cheers,
Johnny
 
P

Peter Macej

But then the question is: How do you convert an .ico file to binary data
that you can paste into the .Addin file?

My VB code looks like this:

Sub Main(ByVal args() As String)
Dim inputFile As String = args(0)
Dim outputFile As String = args(1)

'read bytes
Dim fs As FileStream = New FileStream(inputFile, FileMode.Open,
FileAccess.Read)
Dim r As New BinaryReader(fs)
Dim bytes() As Byte = r.ReadBytes(fs.Length)
r.Close()
fs.Close()

'write hex values as text
Dim sw As StreamWriter = File.CreateText(outputFile)
Dim byt As Byte
For Each byt In bytes
sw.Write(byt.ToString("X2"))
Next
sw.Close()
End Sub

If you need C#, see
http://tech.groups.yahoo.com/group/vsnetaddin/message/3105
 
J

Johnny Jörgensen

Thanks - worked perfectly!

Cheers,
Johnny J.


Peter Macej said:
My VB code looks like this:

Sub Main(ByVal args() As String)
Dim inputFile As String = args(0)
Dim outputFile As String = args(1)

'read bytes
Dim fs As FileStream = New FileStream(inputFile, FileMode.Open,
FileAccess.Read)
Dim r As New BinaryReader(fs)
Dim bytes() As Byte = r.ReadBytes(fs.Length)
r.Close()
fs.Close()

'write hex values as text
Dim sw As StreamWriter = File.CreateText(outputFile)
Dim byt As Byte
For Each byt In bytes
sw.Write(byt.ToString("X2"))
Next
sw.Close()
End Sub

If you need C#, see
http://tech.groups.yahoo.com/group/vsnetaddin/message/3105


--
Peter Macej
Helixoft - http://www.helixoft.com
VSdocman - Commenter and generator of class documentation for C#, VB .NET
and ASP .NET code
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top