Bring Host build into separate project
This commit is contained in:
parent
07b785c183
commit
7bf08c5bd5
76 changed files with 1065 additions and 320 deletions
27
build_projects/shared-build-targets-utils/Utils/PEUtils.cs
Normal file
27
build_projects/shared-build-targets-utils/Utils/PEUtils.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection.PortableExecutable;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public static class PEUtils
|
||||
{
|
||||
public static bool HasMetadata(string pathToFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var inStream = File.OpenRead(pathToFile))
|
||||
{
|
||||
using (var peReader = new PEReader(inStream))
|
||||
{
|
||||
return peReader.HasMetadata;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (BadImageFormatException) { }
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue