Skip to content
This repository was archived by the owner on Jan 11, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<Compile Include="GetPackageDependencies.cs" />
<Compile Include="GitPush.cs" />
<Compile Include="GetNextRevisionNumber.cs" />
<Compile Include="NativeMethods.cs" />
<Compile Include="NormalizePaths.cs" />
<Compile Include="GetDoItemsIntersect.cs" />
<Compile Include="OpenSourceSign.cs" />
Expand Down
25 changes: 0 additions & 25 deletions src/Microsoft.DotNet.Build.Tasks/NativeMethods.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
using System.Text;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
Expand Down Expand Up @@ -67,7 +69,6 @@ internal PrereleaseResolveNuGetPackageAssets(DirectoryExists directoryExists, Fi
/// </summary>
public PrereleaseResolveNuGetPackageAssets()
{
Log.TaskResources = Strings.ResourceManager;
}

/// <summary>
Expand Down Expand Up @@ -156,6 +157,8 @@ public bool OmitTransitiveCompileReferences
/// </summary>
public override bool Execute()
{
Log.TaskResources = Strings.ResourceManager;

try
{
ExecuteCore();
Expand Down Expand Up @@ -664,26 +667,17 @@ private void TryParseRuntimeVersion(string imageRuntimeVersion, out bool isWinMD
/// <returns>The CLR runtime version or empty if the path does not exist.</returns>
private static string TryGetRuntimeVersion(string path)
{
StringBuilder runtimeVersion = null;
uint hresult = 0;
uint actualBufferSize = 0;
int bufferLength = 11; // 11 is the length of a runtime version and null terminator v2.0.50727/0

do
{
runtimeVersion = new StringBuilder(bufferLength);
hresult = NativeMethods.GetFileVersion(path, runtimeVersion, bufferLength, out actualBufferSize);
bufferLength = bufferLength * 2;

} while (hresult == NativeMethods.ERROR_INSUFFICIENT_BUFFER);

if (hresult == NativeMethods.S_OK && runtimeVersion != null)
try
{
return runtimeVersion.ToString();
using (FileStream stream = File.OpenRead(path))
using (PEReader peReader = new PEReader(stream))
{
return peReader.GetMetadataReader().MetadataVersion;
}
}
else
catch (Exception)
{
return String.Empty;
return string.Empty;
}
}
}
Expand Down