Example #1
0
            public object LocateTarget(IServiceProvider serviceProvider, string serializedData)
            {
                DTE vs = (DTE)serviceProvider.GetService(typeof(DTE));

                string[] values   = serializedData.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                webType  kind     = (webType)Enum.Parse(typeof(webType), values[0]);
                string   location = values[1];

                string uniqueName = location;

                if (kind == webType.webTypeFileSystem && !HasDriveSpecification(location))
                {
                    uniqueName = Path.GetDirectoryName(vs.Solution.FileName) + location;
                }

                Project project = DteHelper.FindProject(vs, delegate(Project p)
                {
                    return(string.Equals(p.UniqueName, uniqueName, StringComparison.OrdinalIgnoreCase));
                });

                return(project);
            }