示例#1
0
        private void PatchLockWithExport(ExportFile exportFile)
        {
            if (_lockFile.Version != exportFile.Version)
            {
                throw new LockFilePatchingException($"Export file {exportFile.ExportFilePath} has a different version than the lock file {_lockFile.LockFilePath}");
            }

            var exportDict = exportFile.Exports.ToDictionary(GetTargetLibraryKey);

            var uncoveredLibraries = _msbuildTargetLibraries.Keys.Except(exportDict.Keys);

            if (uncoveredLibraries.Any())
            {
                throw new LockFilePatchingException($"Export {exportFile.ExportFilePath} does not provide exports for all the msbuild projects in {_lockFile.LockFilePath}");
            }

            foreach (var exportKey in exportDict.Keys)
            {
                var export           = exportDict[exportKey];
                var librariesToPatch = _msbuildTargetLibraries[exportKey];

                foreach (var libraryToPatch in librariesToPatch)
                {
                    Patch(libraryToPatch, export);
                }
            }

            _lockFile.ExportFile = exportFile;
        }
示例#2
0
        private void PatchLockWithExport(ExportFile exportFile)
        {
            if (_lockFile.Version != exportFile.Version)
            {
                throw new LockFilePatchingException($"Export file {exportFile.ExportFilePath} has a different version than the lock file {_lockFile.LockFilePath}");
            }

            var exportDict = exportFile.Exports.ToDictionary(GetTargetLibraryKey);

            var uncoveredLibraries = _msbuildTargetLibraries.Keys.Except(exportDict.Keys);
            if (uncoveredLibraries.Any())
            {
                throw new LockFilePatchingException($"Export {exportFile.ExportFilePath} does not provide exports for all the msbuild projects in {_lockFile.LockFilePath}");
            }

            foreach(var exportKey in exportDict.Keys)
            {
                var export = exportDict[exportKey];
                var librariesToPatch = _msbuildTargetLibraries[exportKey];

                foreach (var libraryToPatch in librariesToPatch)
                {
                    Patch(libraryToPatch, export);
                }
            }

            _lockFile.ExportFile = exportFile;
        }