コード例 #1
0
 private void ReplaceGuidMetadataIfExists(_BE.ProjectItem item, string metadataName)
 {
     string value = item.GetMetadata(metadataName).EvaluatedValue;
     if (!string.IsNullOrEmpty(value))
     {
         try
         {
             Guid g = new Guid(value);
             string replaceWith;
             if (guidDictionary.TryGetValue(g, out replaceWith))
             {
                 //VS Guid replacements don't include braces
                 replaceWith = "{" + replaceWith + "}";
                 item.SetMetadataValue(metadataName, replaceWith);
             }
         }
         catch (FormatException)
         {
             Log.LogWarning("Item {0} has specified {1} metadata not in the format of a Guid.", item.EvaluatedInclude, metadataName);
         }
     }
 }