public void AddServiceReferenceMapFile_ProjectHasNoServiceReferences_ServiceReferenceMapAddedToProject() { CreateProjectWithMSBuildProject(); var mapFileName = new ServiceReferenceMapFileName(@"d:\projects\MyProject\Service References", "Service1"); project.AddServiceReferenceMapFile(mapFileName); string fileName = @"d:\projects\MyProject\Service References\Service1\Reference.svcmap"; FileProjectItem item = GetFileFromMSBuildProject(fileName); string lastGenOutput = item.GetMetadata("LastGenOutput"); string generator = item.GetMetadata("Generator"); Assert.AreEqual(ItemType.None, item.ItemType); Assert.AreEqual("Reference.cs", lastGenOutput); Assert.AreEqual("WCF Proxy Generator", generator); }
protected virtual void FixExtensionOfExtraProperties(FileProjectItem item, string sourceExtension, string targetExtension) { List <KeyValuePair <string, string> > replacements = new List <KeyValuePair <string, string> >(); foreach (string metadataName in item.MetadataNames) { if ("Include".Equals(metadataName, StringComparison.OrdinalIgnoreCase)) { continue; } string value = item.GetMetadata(metadataName); if (value.EndsWith(sourceExtension, StringComparison.OrdinalIgnoreCase)) { replacements.Add(new KeyValuePair <string, string>(metadataName, value)); } } foreach (KeyValuePair <string, string> pair in replacements) { item.SetMetadata(pair.Key, Path.ChangeExtension(pair.Value, targetExtension)); } }
protected virtual void FixExtensionOfExtraProperties(FileProjectItem item, string sourceExtension, string targetExtension) { sourceExtension = sourceExtension.ToLowerInvariant(); List<KeyValuePair<string, string>> replacements = new List<KeyValuePair<string, string>>(); foreach (string metadataName in item.MetadataNames) { if ("Include".Equals(metadataName, StringComparison.OrdinalIgnoreCase)) continue; string value = item.GetMetadata(metadataName); if (value.ToLowerInvariant().EndsWith(sourceExtension)) { replacements.Add(new KeyValuePair<string, string>(metadataName, value)); } } foreach (KeyValuePair<string, string> pair in replacements) { item.SetMetadata(pair.Key, Path.ChangeExtension(pair.Value, targetExtension)); } }