JaedenRuiner
Well-known member
- Joined
- Aug 13, 2007
- Messages
- 340
- Programming Experience
- 10+
Well,
I seriously have reviewed as many examples as possible for the installation of a Custom File Generator into the Visual Basic environment and thus far, I have not been able to get it to work. At the moment, my generator doesn't really do anything...Debugging and learning, you see, basically outputting some data, letting me know what happens the the Custom Tool is executed from within the VS IDE. As well as some exposure into the nature of the CodeDOM namespace. (not sure if i'm going to use that or not, but i'm investigating, learning, tis how i've learned every language I use.)
But here's the thing: Following all the steps and procedures, all the attributes and definitions, each time, everything says it's work, the Registry has all the appropriate information that it should have, but when I click "Run Custom Tool" the error comes back: "Cannot Find Custom Tool 'MyCustomTool' on this system."
Hrm.
Now, in the example they use a CodeGeneratorRegistration Attribute to handle the extraneous key additions into the Registry for the Visual Studio Custom Tool lists, currently, (since all that was written in C# and i didn't feel like porting it to VB myself) I'm just using the ComRegisterFunction() and ComUnRegisterFunction() attributes and handling the SOFTWARE\Microsoft\VisualStudio\{0}\Generators\{1}\{2} key/value additions myself (and they work so this shouldn't be an issue).
I Have Strongly Typed this Project with an SNK file as well, before compiling.
here is my class definition in VB, including all my imports so we know what namespaces i'm referencing:
Now, I didn't include the GenerateCode() override because that part is superfluous at the moment, since the error I'm receiving is the Custom Tool isn't on the system, not that the custom tool failed.
So, I set the configuration to Release (no pdb or xml output, just the DLL). I Go to the Directory:
C:\Source\Visual Studio 2008\External Tools
I run:
RegAsm /codebase SettingsGenerator.dll
GacUtil /i SettingsGenerator.dll
I close out VBExpress, reload it, go into my Settings.Settings item in the Solution Explorer and rename the Custom Tool to: FlufSettingsFileGenerator
I then try to "Run Custom Tool" And Get the aforementioned error.
Any Suggestions?
Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner
Report post as abusive
I seriously have reviewed as many examples as possible for the installation of a Custom File Generator into the Visual Basic environment and thus far, I have not been able to get it to work. At the moment, my generator doesn't really do anything...Debugging and learning, you see, basically outputting some data, letting me know what happens the the Custom Tool is executed from within the VS IDE. As well as some exposure into the nature of the CodeDOM namespace. (not sure if i'm going to use that or not, but i'm investigating, learning, tis how i've learned every language I use.)
But here's the thing: Following all the steps and procedures, all the attributes and definitions, each time, everything says it's work, the Registry has all the appropriate information that it should have, but when I click "Run Custom Tool" the error comes back: "Cannot Find Custom Tool 'MyCustomTool' on this system."
Hrm.
Now, in the example they use a CodeGeneratorRegistration Attribute to handle the extraneous key additions into the Registry for the Visual Studio Custom Tool lists, currently, (since all that was written in C# and i didn't feel like porting it to VB myself) I'm just using the ComRegisterFunction() and ComUnRegisterFunction() attributes and handling the SOFTWARE\Microsoft\VisualStudio\{0}\Generators\{1}\{2} key/value additions myself (and they work so this shouldn't be an issue).
I Have Strongly Typed this Project with an SNK file as well, before compiling.
here is my class definition in VB, including all my imports so we know what namespaces i'm referencing:
VB.NET:
Imports System.Runtime.InteropServices
Imports System.Reflection
Imports VSOLE = Microsoft.VisualStudio.OLE.Interop
Imports Microsoft.VisualStudio.TextTemplating.VSHost
Imports Microsoft.Win32
Imports System.CodeDom
Imports System.CodeDom.Compiler
Imports Microsoft.CSharp
Imports Microsoft.VisualBasic
Imports Microsoft.VisualStudio
Imports Microsoft.VisualStudio.Shell
Imports EnvDTE
Imports EnvDTE80
Imports VSLangProj
Namespace Generators
''' <summary>
''' TODO: Documentation
''' </summary>
''' <remarks></remarks>
<ComVisible(True), _
GuidAttribute("EB8B910F-CE35-46d6-B62C-930AB6C910FB"), _
ProvideObject(GetType(FlufSettingsFileGenerator), _
RegisterUsing:=Microsoft.VisualStudio.Shell.RegistrationMethod.CodeBase)> _
Public Class FlufSettingsFileGenerator
Inherits BaseCodeGeneratorWithSite
#Region "-------------::< Fields & Constants >::-------------"
Private Shared CSharpCategory As New Guid("{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}")
Private Shared VBCategory As New Guid("{164B10B9-B200-11D0-8C61-00A0C91E29D5}")
Private Shared CustomToolGuid As New Guid("{EB8B910F-CE35-46d6-B62C-930AB6C910FB}")
Private Shared VS2005Version As New Version(8, 0)
Private Shared VS2008Version As New Version(9, 0)
Private Const CustomToolName As String = "FlufSettingsFileGenerator"
Private Const CustomToolDescription As String = _
"Generator that Creates A FlufApplicationSettings based MySettings Object"
Private Const KeyFormat As String = _
"SOFTWARE\Microsoft\VisualStudio\{0}\Generators\{1}\{2}"
#End Region
#Region "-------------::< Public Methods >::-------------"
<ComRegisterFunction()> _
Public Shared Sub RegisterClass(ByVal t As Type)
' Register for both VS.NET 2005 & 2008 (C#)
Register(VS2005Version, CSharpCategory)
Register(VS2008Version, CSharpCategory)
' Register for both VS.NET 2005 & 2008 (VB)
Register(VS2005Version, VBCategory)
Register(VS2008Version, VBCategory)
End Sub
<ComUnregisterFunction()> _
Public Shared Sub UnregisterClass(ByVal t As Type)
' Unregister for both VS.NET 2005 & 2008 (C#)
Unregister(VS2005Version, CSharpCategory)
Unregister(VS2008Version, CSharpCategory)
' Unregister for both VS.NET 2005 & 2008 (VB)
Unregister(VS2005Version, VBCategory)
Unregister(VS2008Version, VBCategory)
End Sub
#End Region
#Region "-------------::< Protected Methods >::-------------"
Protected Shared Sub Register(ByVal vsVersion As Version, ByVal categoryGuid As Guid)
Using key As RegistryKey = Registry.LocalMachine.CreateSubKey( _
String.Format(KeyFormat, vsVersion, categoryGuid.ToString("B"), CustomToolName))
key.SetValue("", CustomToolDescription)
key.SetValue("CLSID", CustomToolGuid.ToString("B"))
key.SetValue("GeneratesDesignTimeSource", 1)
End Using
End Sub
Protected Shared Sub Unregister(ByVal vsVersion As Version, ByVal categoryGuid As Guid)
Registry.LocalMachine.DeleteSubKey(String.Format(KeyFormat, vsVersion, _
categoryGuid.ToString("B"), CustomToolName), False)
End Sub
#End Region
End Class
Now, I didn't include the GenerateCode() override because that part is superfluous at the moment, since the error I'm receiving is the Custom Tool isn't on the system, not that the custom tool failed.
So, I set the configuration to Release (no pdb or xml output, just the DLL). I Go to the Directory:
C:\Source\Visual Studio 2008\External Tools
I run:
RegAsm /codebase SettingsGenerator.dll
GacUtil /i SettingsGenerator.dll
I close out VBExpress, reload it, go into my Settings.Settings item in the Solution Explorer and rename the Custom Tool to: FlufSettingsFileGenerator
I then try to "Run Custom Tool" And Get the aforementioned error.
Any Suggestions?
Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner
Report post as abusive