コード例 #1
0
        public PackageVersionVariable Update(string variableName, string version)
        {
            if (!_versionVariables.TryGetValue(variableName, out var variable))
            {
                var element = _document.CreatePropertyElement(variableName);
                variable = new PackageVersionVariable(element, version, isReadOnly: false);
                _versionVariables[variableName] = variable;
                variable.AddToGroup(_autoPackageVersions);
            }

            variable.UpdateVersion(version);
            return(variable);
        }
コード例 #2
0
        public PackageVersionVariable AddPinnedVariable(string variableName, string version)
        {
            if (_versionVariables.ContainsKey(variableName))
            {
                throw new InvalidOperationException("Key already exists: " + variableName);
            }

            var element  = _document.CreatePropertyElement(variableName);
            var variable = new PackageVersionVariable(element, version, isReadOnly: true);

            _versionVariables.Add(variableName, variable);
            variable.AddToGroup(_pinnedPackageVersions);
            return(variable);
        }