예제 #1
0
        public string[] GetDllsFromDeps(ProjectDeps deps)
        {
            var pkgs = deps.Libraries.Where(l => string.Equals(l.Value.Type, "project", StringComparison.InvariantCultureIgnoreCase)).Select(l => l.Key).ToArray();

            if (pkgs.Length == 0)
            {
                MessageHelper.Error("Can not find any project dll");
                return(null);
            }

            var dlls = pkgs.Select(p => $"{ParsePackageName(p).name}.dll").ToArray();

            return(dlls);
        }
예제 #2
0
        private string GetPackageDirectory(ProjectDeps deps)
        {
            (string arch, string runtime) = ParseRuntimeInfo(deps);

            return(Path.Combine(GetStoreDirectory(), $"{arch}/{runtime}"));
        }
예제 #3
0
        private (string arch, string runtime) ParseRuntimeInfo(ProjectDeps deps)
        {
            var arch = _options.Architecture;

            if (string.IsNullOrWhiteSpace(arch))
            {
                switch ((deps?.CompilationOptions?.Platform ?? "").ToLower())
                {
                //case "anycpu":
                //    arch = Environment.Is64BitOperatingSystem ? "x64" : "x86";
                //    break;
                case "anycpu32bitpreferred":
                    arch = "x86";
                    break;

                case "x86":
                    arch = "x86";
                    break;

                case "x64":
                    arch = "x64";
                    break;
                    //case "arm":
                    //    arch = "x64";
                    //    break;
                    //case "itanium":
                    //    arch = "x64";
                    //    break;
                    //default:
                    //    throw new NotSupportedException("");
                }
            }

            if (string.IsNullOrWhiteSpace(arch))
            {
                arch = Environment.Is64BitOperatingSystem ? "x64" : "x86";
            }


            var runtime = _options.Runtime;

            if (string.IsNullOrWhiteSpace(runtime))
            {
                var name = deps?.RuntimeTarget?.Name;
                if (!string.IsNullOrWhiteSpace(name))
                {
                    var m = _regRuntime.Match(name);
                    if (m.Success)
                    {
                        runtime = (m.Groups["name"].Value + m.Groups["ver"].Value).ToLower();
                    }
                }
            }

            if (string.IsNullOrWhiteSpace(runtime))
            {
                runtime = "netcoreapp2.0";
            }


            return(arch, runtime);
        }