public void Remove(string fullName) { var invalid = string.IsNullOrWhiteSpace(fullName); if (invalid) { throw new ArgumentException($"'{fullName}' is not valid"); } var path = GetDerivedPath(fullName); var exists = _ioService.FileExists(path); if (exists) { _ioService.Delete(path); } }
/// <summary> /// Find the existing <see cref="ProjectItem"/> associated with the /// provided file name /// </summary> /// <param name="itemName">Name of project item to find</param> /// <returns> /// The <see cref="ProjectItem"/> associated with the provided file name, /// if it exists, and the actual file it references exists /// </returns> public ProjectItem FindProjectItem(string itemName) { ProjectItem itemToReturn = null; var projectItem = _dte2.Solution.FindProjectItem(itemName); if (projectItem != null) { var fullName = projectItem.FileNames[1]; var exists = _ioService.FileExists(fullName); if (exists) { itemToReturn = projectItem; } } return(itemToReturn); }