public static string LoadGuid(string fileName) { // check if a project with specified file is already cached if (_cachedProjects.ContainsKey(fileName)) { // return the guid of the cached project return(((ProjectBase)_cachedProjects[fileName]).Guid); } string projectFileName = ProjectFactory.GetProjectFileName(fileName); string projectExt = Path.GetExtension(projectFileName).ToLower( CultureInfo.InvariantCulture); // check if GUID of project is already cached if (!_cachedProjectGuids.Contains(fileName)) { if (projectExt == ".vbproj" || projectExt == ".csproj" || projectExt == ".vjsproj") { // add project GUID to cache _cachedProjectGuids[fileName] = ManagedProjectBase.LoadGuid(fileName); } else if (projectExt == ".vcproj") { // add project GUID to cache _cachedProjectGuids[fileName] = VcProject.LoadGuid(fileName); } else { throw new BuildException(string.Format(CultureInfo.InvariantCulture, "Unknown project file extension '{0}'.", projectExt, Location.UnknownLocation)); } } // return project GUID from cache return((string)_cachedProjectGuids[fileName]); }