Quantcast
Channel: WE MOVED to github.com/nuget. This site is not monitored!
Viewing all articles
Browse latest Browse all 7612

Commented Issue: packages.config is not checked out (SCM read only flag) so installation fails [3058]

$
0
0
The packages.config is not checked out (SCM read only flag - It's ClearCase: I know its strange. I suffer with my customer...) so installation fails.

Solution: When editing the packages.config check out the file using the VS automation API
Comments: We're working with ClearCase & VS2012/2010 and having the exact same problem. The packages.config is not been checked out when adding a new nuget package to a project. (No check out and no event is fired to the Visual Studio source control plugin). We think that we have located the cause of this behavior. We suspect that the packages.config file is recreated every time a package is added and not written to the file as new line with editing operation. (I.E It creates a new file and overrides the existing one instead of appending to the existing file). We have found (in the source of NuGet manager ver 2.8.1) the following code: PackageReferenceFile.cs private void SaveDocument(XDocument document) { // Sort the elements by package id and only take valid entries (one with both id and version) var packageElements = (from e in document.Root.Elements("package") let id = e.GetOptionalAttributeValue("id") let version = e.GetOptionalAttributeValue("version") where !String.IsNullOrEmpty(id) && !String.IsNullOrEmpty(version) orderby id select e).ToList(); // Remove all elements document.Root.RemoveAll(); // Re-add them sorted document.Root.Add(packageElements); _fileSystem.AddFile(_path, document.Save); } PhysicalFileSystem.cs public virtual void AddFile(string path, Action<Stream> writeToStream) { if (writeToStream == null) { throw new ArgumentNullException("writeToStream"); } AddFileCore(path, writeToStream); } private void AddFileCore(string path, Action<Stream> writeToStream) { EnsureDirectory(Path.GetDirectoryName(path)); string fullPath = GetFullPath(path); using (Stream outputStream = File.Create(fullPath)) { writeToStream(outputStream); } WriteAddedFileAndDirectory(path); } Is it possible to fix this behavior in next version of NuGet? Should we open a Premiere call at Microsoft? This is a must have for us.

Viewing all articles
Browse latest Browse all 7612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>