Use the IDTCommandTarget interface in your add-in, QueryStatus method, and
return vsCommandStatus.vsCommandStatusUnsupported,
vsCommandStatus.vsCommandStatusInvisible or similar if the project type is
not of your acceptance.

Signature
Carlos J. Quintero
The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com
> Hi,
> I have created some custom web-forms and added context menu commands. But
> these commands also appear when the project selected is a windows app or a
> class lib.
> How do i make sure that my context menu appear only when a web project is
> selected and you want to add to it?
back2grid - 13 Dec 2004 17:51 GMT
Carlos,
thx for the reply. My question is specifically how would i identify whether
the selected project is a "Web-Project". I've created a custom web-form and
want it to show up in the context menu "Add My-Webform" only the project
selected is a web-app.
i searched through the applicationObject but couldn't find anything that
identifies the activeproject type. (windows app, web app etc,)
thanks
> Use the IDTCommandTarget interface in your add-in, QueryStatus method, and
> return vsCommandStatus.vsCommandStatusUnsupported,
[quoted text clipped - 7 lines]
> > How do i make sure that my context menu appear only when a web project is
> > selected and you want to add to it?
Carlos J. Quintero [.NET MVP] - 14 Dec 2004 09:11 GMT
You have Project.Properties.Item("ProjectType") (or similar name) which
returns a value of the enum VSLangProj.prjProjectType (prjProjectTypeLocal
or prjProjectTypeWeb).

Signature
Carlos J. Quintero
The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com
> Carlos,
> thx for the reply. My question is specifically how would i identify
[quoted text clipped - 7 lines]
>
> thanks
back2grid - 14 Dec 2004 17:55 GMT
Carlos,
i implemented my web-project check successfully. One issue i saw when
debugging was that the querystatus method was executed after the exec method
the first time my item was selected. Subsequently everytime somebody selects
"Project->Add" the query status is executed and one doesn't see my
custom-menu item for non-web
projects((vsCommandStatus)vsCommandStatus.vsCommandStatusUnsupported|vsCommandStatus.vsCommandStatusInvisible;).
is that a bug or am i missing something?.
Also i wanted to know how can i implement a
"ExecuteCommand("File.AddNewItem","") with my custom web-form pre-selected.
File.AddNewItem doesn't accept any arguments.
thanks in advance
thanks in advance.
> You have Project.Properties.Item("ProjectType") (or similar name) which
> returns a value of the enum VSLangProj.prjProjectType (prjProjectTypeLocal
[quoted text clipped - 11 lines]
> >
> > thanks
Carlos J. Quintero [.NET MVP] - 15 Dec 2004 10:35 GMT
I don´t know about the first question, and about the second I am not sure if
that is possible, but you can add your own "Add My Custom Web-form" entry to
the context menu and skip altogether the selection dialog.

Signature
Carlos J. Quintero
The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com
> Carlos,
> i implemented my web-project check successfully. One issue i saw when
[quoted text clipped - 14 lines]
>
> thanks in advance
back2grid - 16 Dec 2004 00:57 GMT
Carlos,
thanks for the reply. I posted these questions to the VS.NET team, hoping to
get any kind of reply.
Regarding ExecuteCommand method to be pre-selected with a particular type, i
don't think it can be done. i recorded a macro, executing the commands like
File->AddNewItem etc. after that when i selected "my-webform", no event got
registered.
Although in vs.net if you selected project->add->new class.. the dialog box
with a class file appears selected.
Regarding the execution sequence of QueryStatus method, i'm currently
planning to check if the current project selected is a web-project and if not
displaying a user-friendly message to the user until i can get a consistent
solution.
> I don´t know about the first question, and about the second I am not sure if
> that is possible, but you can add your own "Add My Custom Web-form" entry to
[quoted text clipped - 18 lines]
> >
> > thanks in advance