Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / April 2006

Tip: Looking for answers? Try searching our database.

Discovering the VS project from a SchemaImporterExtension

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George - 29 Mar 2006 21:06 GMT
I am stuck here. Any help is greatly appreciated!

I am writing a SchemaImporterExtension for use with "Add Web Reference" in
Visual Studio. Ideally, I want to know within this extension the collection
of dlls that are referenced by the current project, so that I can resolve and
share all the types by reiterating through all the types. For this purpose I
need a way get the current project object model, or at least know the folder
location of the current project.
Josh Twist - 30 Mar 2006 14:29 GMT
Hi George,

I had a very similar idea but I believe this is difficult because the
SchemaImporterExtension is called form WSDL.exe (which is launched by
VS2005's Add Web Reference) and therefore isn't even in the same
process as the project.

I guess the next stage is to see if you can somehow talk to VS2005 but
I've just not had time to follow this through.

I'll be watching this post closely though :)

Josh
http://www.thejoyofcode.com/
George - 31 Mar 2006 15:45 GMT
At last I made it work.

The method is to use COM service (ole32.dll) to iterate through all running
processes and look for a process with the name "VisualStudio.DTE.8.0" +
System.Diagnostics.Process.GetCurrentProcess().Id.ToString(), cast the object
to EnvDTE80.DTE2, then the Project object, say proj, is the first item in the
ActiveSolutionProjects collection. Moreover, by casting proj.Object to
VSProject, the list of references can easily be found.

Now come two more questions:

1) I would like to only generate the old style asynchronous methods
(begin<MethodName> and end<MethodName> methods) instead of the new style
asynchronous methods (<MethodName>async), how can I do that?

2) I want to replace the base class SoapHttpClientProtocol with a class
called MySoapHttpClientProtocol, how can I tell Visual Studio to use the
latter as the base class of generated proxy class?
Josh Twist - 02 Apr 2006 15:18 GMT
Congratulations George,

What happens if you have two instances of Visual Studio running? How do
you know you've found the right process?

In answer to your other two questions, I think you'll need to see what
other extensibility options WSDL.exe supports as it's responsible for
generating the proxy code.

Josh
http://www.thejoyofcode.com/
Josh Twist - 02 Apr 2006 15:22 GMT
PS - Are you sure you need to use interop? Maybve you Could use .NET's
System.Diagnostics.Process.GetProcesses() or GetProcessByName()
methods?

Josh
http://www.thejoyofcode.com/
George - 03 Apr 2006 20:59 GMT
Hi Josh,

The problem with Process methods is that they all return a Process object,
which can not be used to automate Visual Studio. Actually in my approach, I
do use the GetCurrentProcess().Id to identify the instance of relevence. What
I need is a EnvDTE80.DTE2 object, from which the VSProject can be accessed.

George

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.