The return value from VCProject::get_Platforms is incorrect in my C++
VS 2005 addin. Can someone tell me what I'm doing wrong?
/////////////////////////////////////////////////////////////////
EnvDTE::_Solution *sln;
EnvDTE::Projects *prjs;
EnvDTE::Project *prj;
VCProjectEngineLibrary::VCProject *vcp;
hr = m_pDTE->get_Solution(&sln);
if ( SUCCEEDED(hr) )
{
hr = sln->get_Projects(&prjs);
if ( SUCCEEDED(hr) )
{
hr = prjs->Item(CComVariant(1), &prj);
IDispatch *disp;
if ( SUCCEEDED(hr) )
{
vcp = VCProjectEngineLibrary::VCProject *)prj;
hr = vcp->get_Platforms(&disp);
VCProjectEngineLibrary::IVCCollection *plats
=(VCProjectEngineLibrary::IVCCollection *)disp;
//////////////////////////////////////////////////////////////////////
If, in the debugger, I expand the value returned in disp, the vtable
clearly is wrong. In fact the memory pointed to by disp contains a
Unicode string containing the current project name, e.g. myproject.vcproj.
Thanks
green
Wouldn't you know it... as soon as I posted my message, a light bulb
went off in my head. The problem is the cast between EnvDTE::Project
* and VCProjectEngineLibrary::VCProject *. The correct way to do it is:
hr = prj->get_Object(&disp);
vcp = (VCProjectEngineLibrary::VCProject *) disp;
green
--- In vsnetaddin@yahoogroups.com, "greeneyes_2399"
<greeneyes_2399@...> wrote:
>
> The return value from VCProject::get_Platforms is incorrect in my C++
> VS 2005 addin. Can someone tell me what I'm doing wrong?
>
> /////////////////////////////////////////////////////////////////
> EnvDTE::_Solution *sln;
> EnvDTE::Projects *prjs;
> EnvDTE::Project *prj;
> VCProjectEngineLibrary::VCProject *vcp;
> hr = m_pDTE->get_Solution(&sln);
> if ( SUCCEEDED(hr) )
> {
> hr = sln->get_Projects(&prjs);
> if ( SUCCEEDED(hr) )
> {
> hr = prjs->Item(CComVariant(1), &prj);
> IDispatch *disp;
> if ( SUCCEEDED(hr) )
> {
> vcp = VCProjectEngineLibrary::VCProject *)prj;
> hr = vcp->get_Platforms(&disp);
> VCProjectEngineLibrary::IVCCollection *plats
> =(VCProjectEngineLibrary::IVCCollection *)disp;
>
> //////////////////////////////////////////////////////////////////////
>
> If, in the debugger, I expand the value returned in disp, the vtable
> clearly is wrong. In fact the memory pointed to by disp contains a
> Unicode string containing the current project name, e.g.
myproject.vcproj.
>
> Thanks
> green
>
I've created a add-in in VS.NET 2005 using C#.
The add-in loads a tool window OnConnection and it contains a User
Control with input text fields and a "Login" button.
After the user clicks on this button, I want the User Control to
close and open another User Control after.
I was thinking I can have the Exec function in Connect.cs to listen
for events such as a button_click however I had no such luck. Would
this be the correct approach?
I've googled all over, but had no luck finding any advance articles
on handling ToolWindow events.
Any help is greatly appreciated.
Thanks
(The code below will explain a little more of what I'm trying to do.)
public void Exec(string commandName, vsCommandExecOption... )
{
handled=false;
if(executeOption ==
vsCommandExecOption.vsCommandExecOptionDoDefault)
{
if(commandName == "MyAddin.Connect.MyAddin")
{
handled = true;
return;
}
/* Clicking the "Login" button on the User Control form does
not execute this command. Why?*/
if(commandName == "MyAddin.LoginUserControl.btnLogin_Click)
{
/* Code to close LoginUserControl goes here*/
Debug.Print("=========Login button clicked!!=========");
/* Code to open another User Control goes here*/
....
}
}
...
..
/* End of code snippet */
Hi Ngo,
this isn't so much an Add-In problem, as a general .NET programming question.
If the button is on a UserControl, then the handler for the button click event
should go in that UserControl. Just double click on it in the designer window
and it will add the handler function.
Phil
----- Original Message -----
From: ngo_udhs
To: vsnetaddin@yahoogroups.com
Sent: Monday, January 14, 2008 7:28 PM
Subject: [vsnetaddin] Handling Events from ToolWindows in the Connect.cs Class
I've created a add-in in VS.NET 2005 using C#.
The add-in loads a tool window OnConnection and it contains a User
Control with input text fields and a "Login" button.
After the user clicks on this button, I want the User Control to
close and open another User Control after.
I was thinking I can have the Exec function in Connect.cs to listen
for events such as a button_click however I had no such luck. Would
this be the correct approach?
I've googled all over, but had no luck finding any advance articles
on handling ToolWindow events.
Any help is greatly appreciated.
Thanks
(The code below will explain a little more of what I'm trying to do.)
public void Exec(string commandName, vsCommandExecOption... )
{
handled=false;
if(executeOption ==
vsCommandExecOption.vsCommandExecOptionDoDefault)
{
if(commandName == "MyAddin.Connect.MyAddin")
{
handled = true;
return;
}
/* Clicking the "Login" button on the User Control form does
not execute this command. Why?*/
if(commandName == "MyAddin.LoginUserControl.btnLogin_Click)
{
/* Code to close LoginUserControl goes here*/
Debug.Print("=========Login button clicked!!=========");
/* Code to open another User Control goes here*/
....
}
}
...
..
/* End of code snippet */
[Non-text portions of this message have been removed]
Phil,
I understand that event-handling should be done in the Form which it
was created. However is it possible for the Exec method in the
Connect.cs class to listen for commands (i.e. button_Click) on a
User Control? Should the example code below work?
public void Exec(string commandName...
{
...
if(commandName == "MyAddin.MyUserControl.btnMyButton_Click)
{
/* Code to close MyUserControl goes here*/
/* Code to open AnotherUserControl goes here*/
}
...
..
Thanks
--- In vsnetaddin@yahoogroups.com, "Phil Jollans" <phil@...> wrote:
>
> Hi Ngo,
>
> this isn't so much an Add-In problem, as a general .NET
programming question.
>
> If the button is on a UserControl, then the handler for the button
click event should go in that UserControl. Just double click on it
in the designer window and it will add the handler function.
>
> Phil
>
> ----- Original Message -----
> From: ngo_udhs
> To: vsnetaddin@yahoogroups.com
> Sent: Monday, January 14, 2008 7:28 PM
> Subject: [vsnetaddin] Handling Events from ToolWindows in the
Connect.cs Class
>
>
> I've created a add-in in VS.NET 2005 using C#.
>
> The add-in loads a tool window OnConnection and it contains a
User
> Control with input text fields and a "Login" button.
>
> After the user clicks on this button, I want the User Control to
> close and open another User Control after.
>
> I was thinking I can have the Exec function in Connect.cs to
listen
> for events such as a button_click however I had no such luck.
Would
> this be the correct approach?
>
> I've googled all over, but had no luck finding any advance
articles
> on handling ToolWindow events.
>
> Any help is greatly appreciated.
>
> Thanks
>
> (The code below will explain a little more of what I'm trying to
do.)
>
> public void Exec(string commandName, vsCommandExecOption... )
> {
> handled=false;
> if(executeOption ==
> vsCommandExecOption.vsCommandExecOptionDoDefault)
> {
> if(commandName == "MyAddin.Connect.MyAddin")
> {
> handled = true;
> return;
> }
> /* Clicking the "Login" button on the User Control form does
> not execute this command. Why?*/
>
> if(commandName == "MyAddin.LoginUserControl.btnLogin_Click)
> {
> /* Code to close LoginUserControl goes here*/
> Debug.Print("=========Login button clicked!!=========");
> /* Code to open another User Control goes here*/
> ....
> }
> }
> ...
> ..
> /* End of code snippet */
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
Hello all,
I am writing a visual tool that would create custom classes, currently
it uses CodeDOM.
I am stuck a point where I need to parse the code for getting the type
of the custom classes (if they are to be used in another custom class)
For eg:
class A {
public int foo;
}
class B {
public A instance_A;
}
For this I would have to build the solution and get the Type of A from
the assembly ?
or
Should I use codeModel, but then I would have to generate code using
FileCodeModel as well.
Any thoughts ?
Thanks.
In my opinion, CodeDOM, while very powerful is also very frustrating to work
with. I also have created a code generator; however the code for the
classes that I kick out is so complex that I found CodeDOM to be far too
cumbersome and tedious. I mean, who wants to write 60 lines of CodeDOM code
to generate 3 simple overloaded methods and add them to the graph.
Additionally I wanted to structure the code that was kicked out in a way
that CodeDOM just didn't seem flexible enough to accomplish.
My approach has been to create my own code generation providers that inherit
from the built in ones. Then, I create my own object graphs that represent
the various elements that the code generator needs to create and pass them
into the custom language specific custom code providers. In pseudo code:
Public class PersonClassGraph{
public string classname;
Public string namespace;
Public bool generateSomeMethod;
}
Public class CustomCSharpCodeProvider : CSharpCodeProvider{
public void GenerateCodeForPerson(PersonClassGraph graph, TextWriter
writer){
// do whatever logic here to generate your code, probably using
the text writer to just write out code manually.
}
}
The object graphs that I make are FAR simpler than anything represented in
CodeDOM, simply because the data that the graph will contain are going to be
represented by the basic data types in .net. The drawback however is that
now you have to create your own rendering code that normally would be
handled by CodeDOM and the language specific code providers. Personally
though I've found this to be far more manageable since you're basically just
writing out language specific code to a text writer, and again you have full
control over the code that's being generated.
The CodeDOM folks will argue the benefits of that framework, and they are
definitely valid, though if you have code that you want generated that code
dom just doesn't support you will have to resort to writing your own
provider system. I wanted my code to use the null coalescing operator.
Unfortunately this operator is only supported by C#; vb.net requires a
different programming structure to get the same functionality. Because of
this, CodeDOM doesn't expose a method to generate this operator and the only
way to get my code to generate the way that I wanted it to be was to roll my
own system.
I don't know that this answers your question, but it might give you another
avenue to explore.
Josh
http://hurtsmybrains.wordpress.com <http://hurtsmybrains.wordpress.com/>
_____
From: vsnetaddin@yahoogroups.com [mailto:vsnetaddin@yahoogroups.com] On
Behalf Of rishiparkhe
Sent: Monday, February 04, 2008 11:09 PM
To: vsnetaddin@yahoogroups.com
Subject: [vsnetaddin] Code generation and reverse engineering
Hello all,
I am writing a visual tool that would create custom classes, currently
it uses CodeDOM.
I am stuck a point where I need to parse the code for getting the type
of the custom classes (if they are to be used in another custom class)
For eg:
class A {
public int foo;
}
class B {
public A instance_A;
}
For this I would have to build the solution and get the Type of A from
the assembly ?
or
Should I use codeModel, but then I would have to generate code using
FileCodeModel as well.
Any thoughts ?
Thanks.
[Non-text portions of this message have been removed]
Hi Joshua,
Thanks for your comments. I was also thinking about implementing my own
graph
for the code to be generated. And agree that CodeDOM is very powerful,
that's a
good enough point to stick with it.
cheers!
On 05/02/2008, Joshua <abusement@...> wrote:
>
> In my opinion, CodeDOM, while very powerful is also very frustrating to
> work
> with. I also have created a code generator; however the code for the
> classes that I kick out is so complex that I found CodeDOM to be far too
> cumbersome and tedious. I mean, who wants to write 60 lines of CodeDOM
> code
> to generate 3 simple overloaded methods and add them to the graph.
> Additionally I wanted to structure the code that was kicked out in a way
> that CodeDOM just didn't seem flexible enough to accomplish.
>
> My approach has been to create my own code generation providers that
> inherit
> from the built in ones. Then, I create my own object graphs that represent
> the various elements that the code generator needs to create and pass them
> into the custom language specific custom code providers. In pseudo code:
>
> Public class PersonClassGraph{
> public string classname;
>
> Public string namespace;
>
> Public bool generateSomeMethod;
> }
>
> Public class CustomCSharpCodeProvider : CSharpCodeProvider{
> public void GenerateCodeForPerson(PersonClassGraph graph, TextWriter
> writer){
> // do whatever logic here to generate your code, probably using
> the text writer to just write out code manually.
> }
> }
>
> The object graphs that I make are FAR simpler than anything represented in
> CodeDOM, simply because the data that the graph will contain are going to
> be
> represented by the basic data types in .net. The drawback however is that
> now you have to create your own rendering code that normally would be
> handled by CodeDOM and the language specific code providers. Personally
> though I've found this to be far more manageable since you're basically
> just
> writing out language specific code to a text writer, and again you have
> full
> control over the code that's being generated.
>
> The CodeDOM folks will argue the benefits of that framework, and they are
> definitely valid, though if you have code that you want generated that
> code
> dom just doesn't support you will have to resort to writing your own
> provider system. I wanted my code to use the null coalescing operator.
> Unfortunately this operator is only supported by C#; vb.net requires a
> different programming structure to get the same functionality. Because of
> this, CodeDOM doesn't expose a method to generate this operator and the
> only
> way to get my code to generate the way that I wanted it to be was to roll
> my
> own system.
>
> I don't know that this answers your question, but it might give you
> another
> avenue to explore.
>
> Josh
>
> http://hurtsmybrains.wordpress.com <http://hurtsmybrains.wordpress.com/>
>
> _____
>
> From: vsnetaddin@yahoogroups.com <vsnetaddin%40yahoogroups.com> [mailto:
> vsnetaddin@yahoogroups.com <vsnetaddin%40yahoogroups.com>] On
> Behalf Of rishiparkhe
> Sent: Monday, February 04, 2008 11:09 PM
> To: vsnetaddin@yahoogroups.com <vsnetaddin%40yahoogroups.com>
> Subject: [vsnetaddin] Code generation and reverse engineering
>
> Hello all,
>
> I am writing a visual tool that would create custom classes, currently
> it uses CodeDOM.
> I am stuck a point where I need to parse the code for getting the type
> of the custom classes (if they are to be used in another custom class)
>
> For eg:
> class A {
> public int foo;
> }
>
> class B {
>
> public A instance_A;
> }
>
> For this I would have to build the solution and get the Type of A from
> the assembly ?
>
> or
>
> Should I use codeModel, but then I would have to generate code using
> FileCodeModel as well.
>
> Any thoughts ?
>
> Thanks.
>
> [Non-text portions of this message have been removed]
>
>
>
--
keep rendering your thoughts
http://freewebs.com/rishiparkhe
[Non-text portions of this message have been removed]
Hello
I create a stand MSI file from a Deployment project associated to my
addin. The installs for all users - the MSI file is invoked via
msiexec with ALLUSERS=1.
The registry keyes defined are:
HKLM\Software\Microsoft\VisualStudio\7.1\AddIns\VisualPlugin.Connect
HKCU\Software\Microsoft\VisualStudio\7.1\AddIns\VisualPlugin.Connect
This all works well. I can install the software as administrator and
the login as another user. When they start Visual studio the setup for
the addin is invoked and again all works well.
I now uninstall the addin as administrator (msiexec /X add.msi
ALLUSERS=1). This works well for the administrator - when Visual
Studio is restarted the addin is gone and no error messages are
displayed. The registry keys added above are removed and the addin
files have been removed. However when I start visual studio as the
other user I get a Class Not Registered error 80040154. The addin
registry key for the Current User was still present. Does anyone know
if it is possibility to prevent this error message being displayed?
Thanks
Ian
Our addin only adds the LM key, and works fine AFAIK. Are you sure you
need to specify the CU key as well?
-Duncan
vsnetaddin@yahoogroups.com wrote:
> Hello
>
> I create a stand MSI file from a Deployment project associated to my
> addin. The installs for all users - the MSI file is invoked via
> msiexec with ALLUSERS=1.
>
> The registry keyes defined are:
>
> HKLM\Software\Microsoft\VisualStudio\7.1\AddIns\VisualPlugin.Connect
> HKCU\Software\Microsoft\VisualStudio\7.1\AddIns\VisualPlugin.Connect
>
> This all works well. I can install the software as administrator and
> the login as another user. When they start Visual studio the setup for
> the addin is invoked and again all works well.
>
> I now uninstall the addin as administrator (msiexec /X add.msi
> ALLUSERS=1). This works well for the administrator - when Visual
> Studio is restarted the addin is gone and no error messages are
> displayed. The registry keys added above are removed and the addin
> files have been removed. However when I start visual studio as the
> other user I get a Class Not Registered error 80040154. The addin
> registry key for the Current User was still present. Does anyone know
> if it is possibility to prevent this error message being displayed?
>
> Thanks
>
> Ian
>
>
>
>
> Messages in this topic (1)
> ________________________________________________________________________
> ________________________________________________________________________
>
> Replies go to the entire list. Visit http://groups.yahoo.com/group/vsnetaddin
to unsubscribe, search message archives, or change delivery options.
>
>
>
> ------------------------------------------------------------------------
> Yahoo! Groups Links
>
>
>
> ------------------------------------------------------------------------
>
>
Hello
Thank you for the tip, that's solved the problem.
As we want the addin to install for all users as well as single users
is to add a NOT AdminUser condition to the key creation in CU and
only write to LM when AdminUser is true.
Ian
--- In vsnetaddin@yahoogroups.com, Duncan Lees <duncan@...> wrote:
>
> Our addin only adds the LM key, and works fine AFAIK. Are you sure you
> need to specify the CU key as well?
>
> -Duncan
>
> vsnetaddin@yahoogroups.com wrote:
> > Hello
> >
> > I create a stand MSI file from a Deployment project associated to my
> > addin. The installs for all users - the MSI file is invoked via
> > msiexec with ALLUSERS=1.
> >
> > The registry keyes defined are:
> >
> > HKLM\Software\Microsoft\VisualStudio\7.1\AddIns\VisualPlugin.Connect
> > HKCU\Software\Microsoft\VisualStudio\7.1\AddIns\VisualPlugin.Connect
> >
> > This all works well. I can install the software as administrator and
> > the login as another user. When they start Visual studio the setup for
> > the addin is invoked and again all works well.
> >
> > I now uninstall the addin as administrator (msiexec /X add.msi
> > ALLUSERS=1). This works well for the administrator - when Visual
> > Studio is restarted the addin is gone and no error messages are
> > displayed. The registry keys added above are removed and the addin
> > files have been removed. However when I start visual studio as the
> > other user I get a Class Not Registered error 80040154. The addin
> > registry key for the Current User was still present. Does anyone know
> > if it is possibility to prevent this error message being displayed?
> >
> > Thanks
> >
> > Ian
> >
> >
> >
> >
> > Messages in this topic (1)
> >
________________________________________________________________________
> >
________________________________________________________________________
> >
> > Replies go to the entire list. Visit
http://groups.yahoo.com/group/vsnetaddin to unsubscribe, search
message archives, or change delivery options.
> >
> >
> >
> >
------------------------------------------------------------------------
> > Yahoo! Groups Links
> >
> >
> >
> >
------------------------------------------------------------------------
> >
> >
>
To anyone who might be interested.
I've just released a release candidate of my new addin, .netSavant and
wanted to share with the group how much the various postings here have
helped me get this thing completed with some hair left on my head!
Carlos. if it wasn't for your website and constant responses to others
postings, honestly, most of us would probably have given up on addin
development long ago (at least I would have). I can't begin to thank you
enough.
So, if you want to take a look, check out http://www.dotnetsavant.com
<http://www.dotnetsavant.com/>
You can download the release candidate that I'm hoping to fully release in
the next month or so. If you have any constructive feedback I'd love to
hear from you!
Again, thanks a ton!
Joshua Gall
Blog: http://hurtsmybrains.wordpress.com
<http://hurtsmybrains.wordpress.com/>
Email: abusement@...
[Non-text portions of this message have been removed]
Hi All,
I encounterd a problem which i fail to find a solution. I am trying
to get the Class name from a TextPoint (the class name of the
function which the text point is located in) in VS C++.
This code works great in C#:
currentProjectItem.FileCodeModel.CodeElementFromPoint(textPoint,
vsCMElement.vsCMElementClass).Name
however, in Visual C++ -
currentProjectItem.FileCodeModel.CodeElementFromPoint(textPoint,
vsCMElement.vsCMElementClass) -- returns null
i am working with VS 2005.
Any suggestions?
Thanks in advance,
Avi Revivo
Nice Systems
I'm responsible for an add-in that we use to allow our analysts (who
are actually accountants for the most part) to do a build, so the
programmers don't get constantly interrupted for rebuilds for
something the analysts can easily handle.
The add-in uses OnBuildBegin and OnBuildDone event handlers for
logging and error reporting. The event handlers *are* being called.
A trace statement at the beginning of both event handlers fires, so I
get this on my computer:
_BuildEvents_OnBuildBegin(vsBuildScopeSolution, vsBuildActionClean)
_BuildEvents_OnBuildDone(vsBuildScopeSolution, vsBuildActionClean)
_BuildEvents_OnBuildBegin(vsBuildScopeSolution, vsBuildActionBuild)
_BuildEvents_OnBuildDone(vsBuildScopeSolution, vsBuildActionBuild)
...
This is *exactly* what I expect to see, and oddly enough, things work
just fine for me. However, instead of those trace statements, the
rest of the group gets this:
_BuildEvents_OnBuildBegin(0, vsBuildActionClean)
_BuildEvents_OnBuildDone(0, vsBuildActionClean)
_BuildEvents_OnBuildBegin(0, vsBuildActionBuild)
_BuildEvents_OnBuildDone(0, vsBuildActionBuild)
...
Since 0 != vsBuildScopeSolution, the rest of the handler doesn't fire,
and our log is largely useless. The build *does* happen, it just
doesn't report anything about itself.
Has anyone else run into this, and if so, is there a way around it?
I am implementing the package implementation and I need to be able to
modify all the references of either a given class or method. Is there
any way I can do it programatically?
Hello,
I wish to create a custom document window in my VS2005 add-in. It
looks like I need to create a window via CreateDocumentWindow. I've
seen examples on creating a window via CreateToolWindow but nothing on
CreateDocumentWindow. Are there any examples on how to use
CreateDocumentWindow?
Thanks,
Jeff
I can't get this to work. It's registered as present and checked in
the Add-in Manager. But the Script Outline window does not appear.
When I started a new instance of Visual Studio a while ago I did spot
it appearing during start-up but it then disappeared afterwards. Any
ideas?
Kevin
--- In vsnetaddin@yahoogroups.com, "evgenypages" <ekleiman@...> wrote:
>
>
> I'd like to announce an Add-In that I just have written.
> It allows to see a script outline of javascript and vbscript code
> in form of a tree as it was done in Visual Studio 6.
> When I have begun to work in IDE of VS 2005 I was a bit disappointed
> because of luck of this feature. Yes, they add comboboxes at the top of
> any aspx-page but is not the same. More than this, in .js files there
> are no comboboxes. So I decided to write such add-in and it was my
> first add-in in VS 2005. It could be downloaded from here
> <http://www.geocities.com/evgenypages/ScriptOutline.zip> .
> Details and limitations of the program are found in readme.txt and in
> the source code.
> I am very grateful to Carlos Quintero that points me out how to catch
> events WindowActivated and DocumentOpened in add-ins. Any feedback will
> be appreciated
> Evgeny Kleiman
>
>
>
>
> [Non-text portions of this message have been removed]
>
Greetings,
I've an add-in that loads fine but shown as 'dimmed' or 'disabled' in
Tools menu. Here is the OnConnect function implementation:
Try
_applicationObject = CType(application, EnvDTE80.DTE2)
_addInInstance = CType(addInInst, EnvDTE.AddIn)
If connectMode = ext_ConnectMode.ext_cm_UISetup Then
Dim objAddIn As AddIn = CType(addInInst, AddIn)
Dim CommandObj As Command
Dim objCommandBar As CommandBar
ClearExistingCommands()
objCommandBar =
CType(_applicationObject.Commands.AddCommandBar("CommenterMacros",
vsCommandBarType.vsCommandBarTypeMenu,
_applicationObject.CommandBars.Item("Tools")),
Microsoft.VisualStudio.CommandBars.CommandBar)
CommandObj =
_applicationObject.Commands.AddNamedCommand(objAddIn,
"InsertSeeAlsoTag", "InsertSeeAlsoTag", "TODO: Enter your command
description", True, 59, Nothing, 1 + 2)
CommandObj.AddControl(objCommandBar)
End If
Catch ex As Exception
MsgBox(ex.StackTrace, MsgBoxStyle.Information, "Add-in Error")
End Try
'***************************
Where the ClearExistingCommands function as follows:
Private Sub ClearExistingCommands()
Try
For Each cmd As CommandBarControl In
CType(_applicationObject.CommandBars.Item("Tools"), CommandBar).Controls
If cmd.Caption = "CommenterMacros" OrElse cmd.Caption
= "CommentMacros" Then
cmd.Delete()
End If
Next
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Add-in Error")
End Try
End Sub
'**********************************************
When i debug the code it fires an exception on the line:
CommandObj = _applicationObject.Commands.AddNamedCommand(objAddIn,
"InsertSeeAlsoTag", "InsertSeeAlsoTag", "TODO: Enter your command
description", True, 59, Nothing, 1 + 2)
"A Command with that name already exists.". Am i missing something??
I want to run the post build command (as configured in the project
settings) for a specific configuration in a C++ project.
I do have the VCConfiguration object, but I don't know how to go from
here.
Any suggestions?
Enumerate the Tools collection on your object, and look for the tool
that supports the VCPostBuildEventTool interface.
-Duncan
vsnetaddin@yahoogroups.com wrote:
> 1. Run Post Build Command for a VCConfiguration
> Posted by: "hauptmannp" hauptmannp@... hauptmannp
> Date: Thu Jun 12, 2008 7:01 am ((PDT))
>
> I want to run the post build command (as configured in the project
> settings) for a specific configuration in a C++ project.
>
> I do have the VCConfiguration object, but I don't know how to go from
> here.
>
> Any suggestions?
i've an add-in to document classes in XML style, i'm trying to determine
the type of a CodeElement as follows:
Dim fcmFileCodeModel As FileCodeModel =
DTE.ActiveDocument.ProjectItem.FileCodeModel
Dim editPoint As EditPoint =
DTE.ActiveDocument.Selection.TopPoint.CreateEditPoint()
Dim ceElement as CodeElement =
editPoint.CodeElement(vsCMElement.vsCMElementProperty)
on the previous line i get the error:
editPoint.CodeElement(EnvDTE.vsCMElement.vsCMElementProperty)
Overload resolution failed because no accessible 'CodeElement' is most
specific for these arguments:
'Public Overridable ReadOnly Property CodeElement(Scope As
EnvDTE.vsCMElement) As EnvDTE.CodeElement': Not most specific.
'Public Overridable ReadOnly Property CodeElement(Scope As
EnvDTE.vsCMElement) As EnvDTE.CodeElement': Not most specific.
and when i try to use the FileCodeModel object:
ceElement =
fcmFileCodeModel.CodeElementFromPoint(DTE.ActiveDocument.Selection.Activ\
ePoint, vsCMElement.vsCMElementProperty)
i get the following exception:
fcmFileCodeModel.CodeElementFromPoint(editPoint,
vsCMElement.vsCMElementProperty) Run-time exception thrown :
System.Runtime.InteropServices.COMException - Unspecified error
And strange enough it works fine with Classes & Functions , What is
missing??
[Non-text portions of this message have been removed]
--- In vsnetaddin@yahoogroups.com, "noha_assem2030" <noha_assem2030@...>
wrote:
>
> i've an add-in to document classes in XML style, i'm trying to
determine
> the type of a CodeElement as follows:
>
> Dim fcmFileCodeModel As FileCodeModel =
> DTE.ActiveDocument.ProjectItem.FileCodeModel
>
> Dim editPoint As EditPoint =
> DTE.ActiveDocument.Selection.TopPoint.CreateEditPoint()
>
> Dim ceElement as CodeElement =
> editPoint.CodeElement(vsCMElement.vsCMElementProperty)
>
> on the previous line i get the error:
> editPoint.CodeElement(EnvDTE.vsCMElement.vsCMElementProperty)
> Overload resolution failed because no accessible 'CodeElement' is most
> specific for these arguments:
> 'Public Overridable ReadOnly Property CodeElement(Scope As
> EnvDTE.vsCMElement) As EnvDTE.CodeElement': Not most specific.
> 'Public Overridable ReadOnly Property CodeElement(Scope As
> EnvDTE.vsCMElement) As EnvDTE.CodeElement': Not most specific.
>
> and when i try to use the FileCodeModel object:
>
> ceElement =
>
fcmFileCodeModel.CodeElementFromPoint(DTE.ActiveDocument.Selection.Activ\
\
> ePoint, vsCMElement.vsCMElementProperty)
>
> i get the following exception:
> fcmFileCodeModel.CodeElementFromPoint(editPoint,
> vsCMElement.vsCMElementProperty) Run-time exception thrown :
> System.Runtime.InteropServices.COMException - Unspecified error
>
> And strange enough it works fine with Classes & Functions , What is
> missing??
I've found the solution in the following link:
HowTo: Get a code element at the cursor from a visual studio.net macro
or add-in <http://www.mztools.com/articles/2006/MZ2006009.aspx>
[Non-text portions of this message have been removed]
hi @all,
is it possible to create a command from
CommandControlType "vsCommandControlTypeMRUButton"? The last
information that I found in the internet ist a post from carlos on
microsoft connect from 2005.
many thanks for any help
TOM
I want to be able to display my file types in the common file dialogs
in my Visual Studio 2005/2008 C++ addin. What is the best way to
achieve this?
Cheryl
Hi,
I am writing a Visual Studio plugin and have created a new solution
programmatically (C#):
// Assuming applicationObject is a valid DTE2 instance.
Solution2 solution = (Solution2)_applicationObject.Solution;
solution.Close(true);
solution.Create(p.StartInfo.WorkingDirectory, "testSln");
Then I create a new VCProject programmatically:
VCProjectEngine projectEngine = new VCProjectEngineObject();
VCProject project = projectEngine.CreateProject("testProject");
project.AddPlatform("Win32");
project.AddConfiguration("TestConf");
VCConfiguration configuration = (VCConfiguration)
project.Configurations).Item("TestConf");
configuration.ConfigurationType = ConfigurationTypes.typeUnknown;
So far so good. I've looked around for a way to add the VCProject to
the solution but haven't found anything. I have tried doing the following:
project.ProjectFile = "C:\\testProj.vcproj";
project.Save();
solution.AddFromFile(project.ProjectFile, false);
But AddFromFile throws an exception: "Error HRESULT E_FAIL has been
returned from a call to a COM component.".
I am hoping somebody on this list has a solution or is able to point
me to some other forum/mailinglist, where it would make sense to ask.
Best Regards,
Morten Nielsen
Hi,
I want to make an addin which reads an XML code in the center Screen.
When the addin is clicked it should call an Validator Engine which
checks the XML code for errors.
This is my Execute statment:
Public Sub Exec(ByVal commandName As String, ByVal executeOption
As vsCommandExecOption, ByRef varIn As Object, ByRef varOut As Object,
ByRef handled As Boolean) Implements IDTCommandTarget.Exec
handled = False
If executeOption =
vsCommandExecOption.vsCommandExecOptionDoDefault Then
If commandName = "MyAddin1.Connect.MyAddin1" Then
Dim a As New Class1
a.tests()
handled = True
Exit Sub
End If
End If
End Sub
And the Class1 has a function called tests(). The class code is:
Imports EnvDTE
Imports EnvDTE80
Imports System.IO
Imports Extensibility
Imports System.Xml
Public Class Class1
Dim applicationObject As DTE2
Dim mydoc As XmlDocument
Public Sub tests()
'cmmd = applicationObject.Commands.Item("File.Open")
'i = cmmd.ID
'guid = cmmd.Guid
'name = cmmd.Name
Dim e As Int16 = 2
Dim fs As New FileStream("C:\Validation.xml", FileMode.Open,
FileAccess.Read)
Dim d As New StreamReader(fs)
d.BaseStream.Seek(0, SeekOrigin.Begin)
While d.Peek() > -1
MsgBox(d.ReadLine)
End While
End Sub
End Class
When I try to do the following
mydoc.Load("/abc.xml")
dim node as XMLNode
node= myDoc.DocumentElement
MsgBox(node.ToString)
It doesnt work... But when I use the StreamReader it works perfctly.
Can I Load an XML file using the Load method?
Please Advice..
Thanks
Hi guys,
Very quiet on ths group these days, but hopefully some people are still
listening... :-)
I've just released a plugin for VS 2005/2008 that you may find handy.
It includes several clipboard and outlining helpers, but the primary util is a
DocXml/Doxygen comment auto-generator for C/C++/C#/Java. This scans the code
element (method, class, struct, enum, etc) under the cursor and generates a
document comment, automaticallly deriving useful comment text from the names and
types used. If a comment already exists, it will update it to reflect any
changes to the code element (new parameters, etc). If base-class or override
documentation is available, it will be used to help populate the doc comment.
The format and auto-commenting rules used are all easily configurable via a
simple XML file.
Unlike similar add-ins, AtomineerUtils parses the code directly (rather than
relying on intellisense) so it works for non-compilable (incomplete) code, code
in comment blocks, etc.
Full details and a free download can be found here:
http://www.atomineer.com/AtomineerUtils.html
Cheers,
Jason
Hi Jason,
> Very quiet on ths group these days, but hopefully some people are still
listening... :-)
> I've just released a plugin for VS 2005/2008 that you may find handy.
> It includes several clipboard and outlining helpers, but the primary util
is a DocXml/Doxygen comment auto-generator for C/C++/C#/Java. This scans the
code element (method, class, struct, enum, etc) under the cursor and
generates a document comment, automaticallly deriving useful comment text
from the names and types used. If a comment already exists, it will update
it to reflect any changes to the code element (new parameters, etc). If
base-class or override documentation is available, it will be used to help
populate the doc comment. The format and auto-commenting rules used are all
easily configurable via a simple XML file.
Thanks for taking the time to post this. I'm sure there are plenty of people
listening (would "lurking" be a better description...?) and I'm sure some
will find it useful. :)
FWIW the only reason I've not posted on here in ages is that the VS
interfacing code I work with is largely now stable (though no doubt VS2010
will try to change that!) and my focus has largely been elseware (user
interface, installer, product support etc.).
That said, my partner Beth is doing some interesting experimentation with
Visual Studio text markers in a C++ add-in at the moment, so hopefully there
will be a "proof of concept" add-in and associated article in due course to
chat about.
Cheers,
Anna x
http://www.riverblade.co.uk
MSN IM: arrythedog@... (don't ask!)
Twitterings: http://twitter.com/annajayne