OLD | NEW |
| (Empty) |
1 /// Copyright (c) Microsoft Corporation. All rights reserved. | |
2 | |
3 using System; | |
4 using Microsoft.VisualStudio; | |
5 using Microsoft.VisualStudio.Shell; | |
6 using Microsoft.VisualStudio.Shell.Interop; | |
7 | |
8 namespace Microsoft.VisualStudio.Project | |
9 { | |
10 public class BuildDependency : IVsBuildDependency | |
11 { | |
12 Guid referencedProjectGuid = Guid.Empty; | |
13 ProjectNode projectMgr = null; | |
14 | |
15 [CLSCompliant(false)] | |
16 public BuildDependency(ProjectNode projectMgr, Guid projectRefer
ence) | |
17 { | |
18 this.referencedProjectGuid = projectReference; | |
19 this.projectMgr = projectMgr; | |
20 } | |
21 | |
22 #region IVsBuildDependency methods | |
23 public int get_CanonicalName(out string canonicalName) | |
24 { | |
25 canonicalName = null; | |
26 return VSConstants.S_OK; | |
27 } | |
28 | |
29 public int get_Type(out System.Guid guidType) | |
30 { | |
31 // All our dependencies are build projects | |
32 guidType = VSConstants.GUID_VS_DEPTYPE_BUILD_PROJECT; | |
33 return VSConstants.S_OK; | |
34 } | |
35 | |
36 public int get_Description(out string description) | |
37 { | |
38 description = null; | |
39 return VSConstants.S_OK; | |
40 } | |
41 | |
42 [CLSCompliant(false)] | |
43 public int get_HelpContext(out uint helpContext) | |
44 { | |
45 helpContext = 0; | |
46 return VSConstants.E_NOTIMPL; | |
47 } | |
48 | |
49 public int get_HelpFile(out string helpFile) | |
50 { | |
51 helpFile = null; | |
52 return VSConstants.E_NOTIMPL; | |
53 } | |
54 | |
55 public int get_MustUpdateBefore(out int mustUpdateBefore) | |
56 { | |
57 // Must always update dependencies | |
58 mustUpdateBefore = 1; | |
59 | |
60 return VSConstants.S_OK; | |
61 } | |
62 | |
63 public int get_ReferredProject(out object unknownProject) | |
64 { | |
65 unknownProject = null; | |
66 | |
67 unknownProject = this.GetReferencedHierarchy(); | |
68 | |
69 // If we cannot find the referenced hierarchy return S_F
ALSE. | |
70 return (unknownProject == null) ? VSConstants.S_FALSE :
VSConstants.S_OK; | |
71 } | |
72 | |
73 #endregion | |
74 | |
75 #region helper methods | |
76 private IVsHierarchy GetReferencedHierarchy() | |
77 { | |
78 IVsHierarchy hierarchy = null; | |
79 | |
80 if(this.referencedProjectGuid == Guid.Empty || this.proj
ectMgr == null || this.projectMgr.IsClosed) | |
81 { | |
82 return hierarchy; | |
83 } | |
84 | |
85 return VsShellUtilities.GetHierarchy(this.projectMgr.Sit
e, this.referencedProjectGuid); | |
86 | |
87 } | |
88 | |
89 #endregion | |
90 | |
91 } | |
92 } | |
OLD | NEW |