public UWPAssemblyResolver(string projectLockFile)
        {
            if (string.IsNullOrEmpty(projectLockFile))
            {
                throw new Exception("Project lock file not specified.");
            }
            NuGetPackageResolver resolver1 = new NuGetPackageResolver {
                ProjectLockFile = projectLockFile
            };

            resolver1.Resolve();
            string[] resolvedReferences = resolver1.ResolvedReferences;
            this._resolvedReferences = new Dictionary <string, string>(resolvedReferences.Length, StringComparer.InvariantCultureIgnoreCase);
            foreach (string str in resolvedReferences)
            {
                string fileName = Path.GetFileName(str);
                if (this._resolvedReferences.ContainsKey(fileName))
                {
                    throw new Exception(string.Format("Reference \"{0}\" already added as \"{1}\".", str, this._resolvedReferences[fileName]));
                }
                this._resolvedReferences.Add(fileName, str);
            }
            foreach (string str3 in UWPReferences.GetReferences())
            {
                string key = Path.GetFileName(str3);
                if (this._winmdReferences.ContainsKey(key))
                {
                    throw new Exception(string.Format("Reference \"{0}\" already added as \"{1}\".", str3, this._winmdReferences[key]));
                }
                this._winmdReferences.Add(key, str3);
            }
        }
예제 #2
0
        public NuGetAssemblyResolver(string projectLockFile)
        {
            NuGetPackageResolver resolver = new NuGetPackageResolver {
                ProjectLockFile = projectLockFile
            };

            resolver.Resolve();
            string[] resolvedReferences = resolver.ResolvedReferences;
            this._references = new Dictionary <string, string>(resolvedReferences.Length, StringComparer.InvariantCultureIgnoreCase);
            foreach (string str in resolvedReferences)
            {
                string str3;
                string fileName = Path.GetFileName(str);
                if (this._references.TryGetValue(fileName, out str3))
                {
                    throw new Exception($"Reference " { str } " already added as " { str3 } ".");
                }
                this._references.Add(fileName, str);
            }
        }