Skip to content

Commit 6433c4b

Browse files
committed
Make the project function with .Net Framework classes again
1 parent 54108b6 commit 6433c4b

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/coverlet.console/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ static int Main(string[] args)
5656
process.StartInfo.Arguments = targs.HasValue() ? targs.Value() : string.Empty;
5757
process.StartInfo.CreateNoWindow = true;
5858
process.StartInfo.RedirectStandardOutput = true;
59+
process.StartInfo.RedirectStandardError = true;
5960
process.Start();
6061
logger.LogInformation(process.StandardOutput.ReadToEnd());
62+
logger.LogError(process.StandardError.ReadToEnd());
6163
process.WaitForExit();
6264

6365
var dOutput = output.HasValue() ? output.Value() : Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar.ToString();

src/coverlet.core/Coverage.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ private string GetSourceLinkUrl(Dictionary<string, string> sourceLinkDocuments,
275275
string key = sourceLinkDocument.Key;
276276
if (Path.GetFileName(key) != "*") continue;
277277

278-
string relativePath = Path.GetRelativePath(Path.GetDirectoryName(key), Path.GetDirectoryName(document));
278+
string relativePath = GetRelativePath(Path.GetDirectoryName(key), Path.GetDirectoryName(document));
279279

280280
if (relativePath.Contains("..")) continue;
281281

@@ -300,5 +300,18 @@ private string GetSourceLinkUrl(Dictionary<string, string> sourceLinkDocuments,
300300
url = sourceLinkDocuments[keyWithBestMatch];
301301
return url.Replace("*", replacement);
302302
}
303+
304+
// This is coming to .NET Standard 2.1 as part of Path
305+
private static string GetRelativePath(string relativeTo, string path)
306+
{
307+
var uri = new Uri(relativeTo);
308+
var relativePath = Uri.UnescapeDataString(uri.MakeRelativeUri(new Uri(path)).ToString()).Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
309+
if (relativePath.Contains(Path.DirectorySeparatorChar.ToString()) == false)
310+
{
311+
relativePath = $".{ Path.DirectorySeparatorChar }{ relativePath }";
312+
}
313+
314+
return relativePath;
315+
}
303316
}
304317
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Library</OutputType>
5-
<TargetFramework>netcoreapp2.0</TargetFramework>
5+
<TargetFramework>netstandard2.0</TargetFramework>
66
<AssemblyVersion>4.1.0</AssemblyVersion>
77
</PropertyGroup>
88

99
<ItemGroup>
1010
<PackageReference Include="Mono.Cecil" Version="0.10.1" />
1111
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
1212
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="2.0.1" />
13+
<PackageReference Include="System.Reflection.Metadata" Version="1.6.0" />
1314
</ItemGroup>
14-
1515
</Project>

0 commit comments

Comments
 (0)