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 / Visual Studio.NET / Extensibility / September 2005

Tip: Looking for answers? Try searching our database.

IVsSolution::GetProjectOfUniqueName returns E_FAIL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Notre Poubelle - 31 Aug 2005 21:21 GMT
Hello,

I'm trying to use IVsSolution::GetProjectOfUniqueName to get the
IVSHierarchy of a named project.  I've used IEnumHierarchies to verify there
is only one hierarchy in the solution, but when I call
IVsSolution::GetProjectOfUniqueName, it returns E_FAIL.

What might cause this problem?
Thanks,
Notre
"Gary Chang[MSFT]" - 01 Sep 2005 10:36 GMT
Hi Notre,

Currently, we are looking into this problem.

Would you please illustrate some related sample code which used to call the
IVsSolution::GetProjectOfUniqueName, we will update you as soon as we get
anything out.

Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Notre Poubelle - 01 Sep 2005 17:34 GMT
Hi Gary,

Here's some sample code.  This code is defined within a command handler
(associated with MenuCommand) in my ProjectNode derived class, which is
executed after the hierarchy has been fully built and visualized.  This code
is written in C#, primarily against the interop assemblies.

IVsSolution solution =
Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsSolution)) as
IVsSolution;
if (solution != null)
{
    IVsHierarchy hierarchy1;
    EnvDTE.Project project = (EnvDTE.Project) GetAutomationObject();
    string uniqueName = project.UniqueName;
    int hr = solution.GetProjectOfUniqueName(uniqueName, out hierarchy1);
              //hr == VSConstants.E_FAIL
}

The following code sample was also run to enumerate the number of projects
(hierarchies) in the solution and to determine the project name of each
hierarchy.  After running the following code, 1 project hierarchy is returned
in the solution, and the project.uniquename matches the value passed into
GetProjectofUniqueName above.

Guid empty = new Guid();
IEnumHierarchies hierarchies;
hr = solution.GetProjectEnum((uint) __VSENUMPROJFLAGS.EPF_ALLPROJECTS, ref
empty, out hierarchies);

IVsHierarchy[] test = new IVsHierarchy[1];
while (hierarchies.Next(1, test, out fetched) == VSConstants.S_OK)
{
    object obj;
    hr = test[0].GetProperty(VSConstants.VSITEMID_ROOT,
(int)__VSHPROPID.VSHPROPID_ExtObject, out obj);
    EnvDTE.Project proj = (EnvDTE.Project)obj;
    System.Diagnostics.Trace.WriteLine(proj.UniqueName);
}

Notre
"Gary Chang[MSFT]" - 02 Sep 2005 09:22 GMT
Hi Notre,

Thanks for your detailed reply!

>string uniqueName = project.UniqueName;
>int hr = solution.GetProjectOfUniqueName(uniqueName, out hierarchy1);

it appears the project.UniqueName doesn't work here, the project path needs
to be relative to the solution. I suggest you can confirm by enumerating
the hierarchies and call the GetUniqueNameOfProject to pass the returned
string to the GetProjectOfUniqueName...

Wish this helps!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Notre Poubelle - 02 Sep 2005 18:21 GMT
Hi Gary,

This question was answered by one of your colleages in the post

http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=81276

Notre
"Gary Chang[MSFT]" - 03 Sep 2005 03:21 GMT
That's Okay, Notre!

I think our VSIP specialist Mike has already give you a more detailed
explanation on this issue:)

Good Luck!

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

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.