diff --git a/Directory.Build.props b/Directory.Build.props index 600689f1..3d207d2b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -22,6 +22,7 @@ true netcoreapp3.1 true + NU1901;NU1902;NU1903;NU1904;CA1724 diff --git a/src/core/Statiq.Testing/IO/TestDirectory.cs b/src/core/Statiq.Testing/IO/TestDirectory.cs index 99876742..fdd3a9cd 100644 --- a/src/core/Statiq.Testing/IO/TestDirectory.cs +++ b/src/core/Statiq.Testing/IO/TestDirectory.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Security.Cryptography; using System.Threading.Tasks; using Statiq.Common; @@ -16,14 +17,17 @@ public TestDirectory(IReadOnlyFileSystem fileSystem, TestFileProvider fileProvid { _fileSystem = fileSystem; _fileProvider = fileProvider; - Path = path; + + // Use a slash for an empty path (can't compare to NormalizePath.Empty since this might be absolute + // in the case of a ".." from the globber, and that's always relative, so compare against FullPath) + Path = path.FullPath == string.Empty ? NormalizedPath.Slash : path; } public NormalizedPath Path { get; } NormalizedPath IFileSystemEntry.Path => Path; - public bool Exists => _fileProvider.Directories.Contains(Path); + public bool Exists => Path == NormalizedPath.Slash || _fileProvider.Directories.Contains(Path); public DateTime LastWriteTime { get; set; } diff --git a/src/core/Statiq.Testing/IO/TestFileProvider.cs b/src/core/Statiq.Testing/IO/TestFileProvider.cs index cc7dc5fe..89c58500 100644 --- a/src/core/Statiq.Testing/IO/TestFileProvider.cs +++ b/src/core/Statiq.Testing/IO/TestFileProvider.cs @@ -71,4 +71,4 @@ public void AddFile(NormalizedPath path, string content = "") IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } -} +} \ No newline at end of file diff --git a/src/extensions/Statiq.CodeAnalysis/AnalyzeCSharp.cs b/src/extensions/Statiq.CodeAnalysis/AnalyzeCSharp.cs index 5fe121ff..c6c9ef83 100644 --- a/src/extensions/Statiq.CodeAnalysis/AnalyzeCSharp.cs +++ b/src/extensions/Statiq.CodeAnalysis/AnalyzeCSharp.cs @@ -462,7 +462,8 @@ protected override async Task> ExecuteContextAsync(IExecu .WithReferences(mscorlib) .WithOptions(new CSharpCompilationOptions( OutputKind.DynamicallyLinkedLibrary, - xmlReferenceResolver: new XmlFileResolver(context.FileSystem.RootPath.FullPath))); + xmlReferenceResolver: new XmlFileResolver( + context.FileSystem.RootPath.FullPath == NormalizedPath.Slash ? null : context.FileSystem.RootPath.FullPath))); // Add the input source and references List symbols = new List();