Enable crossgen for CLI SDK binaries.
TODO: Write tests to make sure aseemblies are crossgened.
This commit is contained in:
parent
880dcf2fc8
commit
d6fe71d4dd
3 changed files with 97 additions and 59 deletions
27
scripts/dotnet-cli-build/Utils/PEUtils.cs
Normal file
27
scripts/dotnet-cli-build/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 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