コード例 #1
0
        private static string GetIlasmPath()
        {
            if (ExecutionConditionUtil.IsWindowsDesktop)
            {
                // The desktop ilasm is still necessary because a number of our tests depend on being able to
                // emit PDB files for net modules. That feature is not available on coreclr ilasm.
                return(Path.Combine(
                           Path.GetDirectoryName(RuntimeUtilities.GetAssemblyLocation(typeof(object))),
                           "ilasm.exe"));
            }

            var    ilasmExeName = PlatformInformation.IsWindows ? "ilasm.exe" : "ilasm";
            var    directory    = Path.GetDirectoryName(RuntimeUtilities.GetAssemblyLocation(typeof(RuntimeUtilities)));
            string ridName;

            if (ExecutionConditionUtil.IsWindows)
            {
                ridName = "win-x64";
            }
            else if (ExecutionConditionUtil.IsMacOS)
            {
                ridName = "osx-x64";
            }
            else if (ExecutionConditionUtil.IsLinux)
            {
                ridName = "linux-x64";
            }
            else
            {
                throw new PlatformNotSupportedException("Runtime platform not supported for testing");
            }

            return(Path.Combine(directory, "runtimes", ridName, "native", ilasmExeName));
        }
コード例 #2
0
        private static string GetIlasmPath()
        {
            if (ExecutionConditionUtil.IsWindowsDesktop)
            {
                return(Path.Combine(
                           Path.GetDirectoryName(RuntimeUtilities.GetAssemblyLocation(typeof(object))),
                           "ilasm.exe"));
            }
            else
            {
                var ilasmExeName = PlatformInformation.IsWindows ? "ilasm.exe" : "ilasm";

                var    directory = Path.GetDirectoryName(RuntimeUtilities.GetAssemblyLocation(typeof(RuntimeUtilities)));
                string path      = null;
#if DEBUG
                const string configuration = "Debug";
#else
                const string configuration = "Release";
#endif

                while (directory != null && !File.Exists(path = Path.Combine(directory, "artifacts", "tools", "ILAsm", configuration, ilasmExeName)))
                {
                    directory = Path.GetDirectoryName(directory);
                }

                if (directory == null)
                {
                    throw new NotSupportedException("Unable to find CoreCLR ilasm tool. Has the Microsoft.NETCore.ILAsm package been published to /artifacts/tools?");
                }

                return(path);
            }
        }
コード例 #3
0
        private static string GetIlasmPath()
        {
            if (CoreClrShim.AssemblyLoadContext.Type == null)
            {
                return(Path.Combine(
                           Path.GetDirectoryName(RuntimeUtilities.GetAssemblyLocation(typeof(object))),
                           "ilasm.exe"));
            }
            else
            {
                var ilasmExeName = PlatformInformation.IsWindows ? "ilasm.exe" : "ilasm";

                var    directory = Path.GetDirectoryName(RuntimeUtilities.GetAssemblyLocation(typeof(RuntimeUtilities)));
                string path      = null;
                while (directory != null && !File.Exists(path = Path.Combine(directory, "Binaries", "Tools", "ILAsm", ilasmExeName)))
                {
                    directory = Path.GetDirectoryName(directory);
                }

                if (directory == null)
                {
                    throw new NotSupportedException("Unable to find CoreCLR ilasm tool. Has the Microsoft.NETCore.ILAsm package been published to ./Binaries/Tools?");
                }

                return(path);
            }
        }