andrewabest / Conventional

A suite of convention specifications for enforcing type and style conventions in your codebase
Microsoft Public License
97 stars 29 forks source link

KnownPaths: Azure directory structure breaks DefaultSolutionRootFinder. #49

Closed KaelLarkin closed 6 years ago

KaelLarkin commented 6 years ago

DefaultSolutionRootFinder = x => x.Substring(0, x.LastIndexOf("\\bin\\", StringComparison.Ordinal));

VSTS build agents don't seem to have a \\bin\\ directory, causing this to fail on static construction. The main issue is that it throws before being able to reassign SolutionRootFinder.

Maybe:

DefaultSolutionRootFinder = x => 
{
   var index = x.LastIndexOf("\\bin\\", StringComparison.Ordinal);
   if (index < 0)   
      return String.Empty;
   else   
      return x.Substring(0, index);
}

I can put this in a PR if you'd like, or let me know if I've messed up somewhere.

andrewabest commented 6 years ago

Fixed with #50