Skip to content

Instantly share code, notes, and snippets.

@sm-g
Created November 22, 2015 02:37
Show Gist options
  • Save sm-g/cf0e1d6092398089a57c to your computer and use it in GitHub Desktop.
Save sm-g/cf0e1d6092398089a57c to your computer and use it in GitHub Desktop.
diff --git a/src/SolutionCop.DefaultRules/Basic/FilesIncludedIntoProjectRule.cs b/src/SolutionCop.DefaultRules/Basic/FilesIncludedIntoProjectRule.cs
index 54ed67e..c4976d7 100644
--- a/src/SolutionCop.DefaultRules/Basic/FilesIncludedIntoProjectRule.cs
+++ b/src/SolutionCop.DefaultRules/Basic/FilesIncludedIntoProjectRule.cs
@@ -80,6 +80,7 @@ namespace SolutionCop.DefaultRules.Basic
}
foreach (var filePatternToProcess in config.FilePatternsToProcess)
{
+ var projectDirPath = new DirectoryInfo(Path.GetDirectoryName(projectFilePath)).FullName;
var filePaths = Directory.EnumerateFiles(Path.GetDirectoryName(projectFilePath), filePatternToProcess, SearchOption.AllDirectories);
// TODO More flexible folder exclusions
@@ -98,7 +99,7 @@ namespace SolutionCop.DefaultRules.Basic
if (!xmlHintPaths.Any())
{
// TODO Yak!
- var fileSubPath = Path.GetFileName(Path.GetDirectoryName(projectFilePath)) + Path.DirectorySeparatorChar + Path.GetFullPath(filePath).Substring(Path.GetDirectoryName(projectFilePath).Length + 1);
+ var fileSubPath = Path.GetFileName(projectDirPath) + Path.DirectorySeparatorChar + Path.GetFullPath(filePath).Substring(projectDirPath.Length + 1);
yield return string.Format("File is not referenced in project: {0}", fileSubPath);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment