Update/Clean offline Visual Studio installer [duplicate] - visual-studio

Is there a possibility to remove the old versions of installation packages from the layout folder of Visual Studio 2017 offline installation? This folder needs a lot of memory on my HDD.

You can use the new --clean option. You'll need the file path(s) to catalog manifest(s) that contain those obsolete packages. You can find the catalog manifests in an Archive folder in the offline layout cache.
They are saved there when you update a layout. In the "Archive" folder, there is one or more GUID named folders, each of which contains an obsolete catalog manifest. The number of GUID folders should be the same as the number of updates made to your offline cache.
A few files are saved inside each GUID folder. The two files of most interest are a catalog.json file and a version.txt file. The catalog.json file is the obsolete catalog manifest you'll need to pass to the --clean option. The version.txt file contains the version of this obsolete catalog manifest. Based on the version number, you can decide whether you want to remove obsolete packages from this catalog manifest. You can do the same as you go through the other GUID folders. After you make the decision on the catalog(s) you want to clean, run the --clean command by supplying the files paths to these catalogs.
Examples:
vs_enterprise.exe --layout <layoutDir> --clean <file-path-of-catalog1> <file-path-of-catalog2> …
vs_enterprise.exe --layout <layoutDir> --clean <file-path-of-catalog1> --clean <file-path-of-catalog2> …
You can also invoke vs_enterprise.exe inside the <layoutDir>. Here's an example:
c:\VS2017Layout\vs_enterprise.exe --layout c:\VS2017Layout --clean c:\VS2017Layout\Archive\1cd70189-fc55-4583-8ad8-a2711e928325\Catalog.json --clean c:\VS2017Layout\Archive\d420889f-6aad-4ba4-99e4-ed7833795a10\Catalog.json
When you execute this command, Setup analyzes your offline cache folder to find the list of files that it will remove. You will then have a chance to review the files that are going to be deleted and confirm the deletions.

I had created a small utility application for deleting old version folders from Visual Studio 2017 offline setup.
You can download the source from GitHub at https://github.com/deepak-rathi/VS2017OfflineSetupUtility
Or
Run the executable VS2017OfflineSetupUtility.exe from Release folder
https://github.com/deepak-rathi/VS2017OfflineSetupUtility/tree/master/VS2017OfflineSetupUtility/bin/Release

After you perform layout updates to an offline cache, the layout
cache folder may have some obsolete packages that are no longer needed
by the latest Visual Studio installation. You can use the --clean
option to remove obsolete packages from an offline cache folder.
Microsft Docs: How to remove older versions from a layout

Related

Uninstall nuget packages installed with nuget.exe

I was having trouble with nuget Visual Studio 2017 and wanted to test if it was our proxy server or not. I downloaded nuget.exe and dropped it at the root of my C drive. I executed nuget.exe install Microsoft.AspNetCore and it asked for my proxy server username and password. I supplied it, and it proceeded to create dozens of directories in C:\ with that package and all of it's dependencies (can I get a DOH!) Problem is, there's no uninstall in nuget.exe. The package manager in VS isn't available unless you have a solution open, and the package manager console (powershell) won't uninstall unless you have a solution open. Can I just clobber all those directories and their contents? Or will that just make things different and somehow worse:
Can I just clobber all those directories and their contents? Or will that just make things different and somehow worse
Yes, you can (If you confirm that you no longer need these packages).
According to the document install command (NuGet CLI):
The install command does not modify a project file or packages.config;
in this way it's similar to restore in that it only adds packages to
disk but does not change a project's dependencies.
When you use nuget.exe install some packages, it just download those packages to the disk and not change anything in the project, this is similar to some files you downloaded from the internet.
So, if you do not need those packages any more, you can just delete them from the disk manually.
Besides, there is an option delete command (NuGet CLI), which can be used to deletes or unlists a package from a package source. The exact behavior depends on the source. For local folders, for instance, the package is deleted; for nuget.org the package is unlisted. But it only delete the file .nupkg and will keep the folders and other files of other packages, like lib folder. If you want remove the package completely, just delete those packages manually.
Hope this helps.

Visual Studio 2017 Offline Installation Still Wants Internet Connection

I created an offline layout folder using the following command:
vs_enterprise.exe --layout c:\vs2017layout --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Component.GitHub.VisualStudio --includeOptional --lang en-US
I then copied the entire resulted vs2017layout folder (~2.57GB) to another machine that does not have internet access and ran the following command:
vs_enterprise.exe --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Component.GitHub.VisualStudio --includeOptional --lang en-US
However, the installer still wants internet connection. Please advise on what I'm missing.
Thank you in advance.
Turns out I need to manually import the certificates that were downloaded to the offline folder on the machine.
Found this info from this blog post: http://www.kunal-chowdhury.com/2016/11/visual-studio-2017-offline-installer.html#C3t0q0XUUVqgvqyy.97
Please run https://aka.ms/vscollect.exe and upload your logs to a new issue on https://developercommunity.visualstudio.com. Logs will then only be available for you and us to see and diagnose.
I also had this kind of problem. However I managed to solve it by installing Visual Studio in online computer from downloaded Layout, waiting for installation to complete, then copy the Download Cache (by default located in %programdata%\Microsoft\VisualStudio\Packages) into existing Layout.
This way some missing packages also get included and hopefully the layout installer no longer require internet for next offline installations.
When started, installer download file Catalog.json, containing list of all packages, versions, file sizes and checksum. Using this data installer check size and crc of all already downloaded files, using information in file Catalog.json at installation root.
If Your installer not use downloaded files, this may be due to the following reasons:
incomplete download, wrong size or crc of downloaded files (View
file Catalog.json at installation root.);
there is newer version of file (version,crc & size look at Catalog.json).

MSBuild fails due to invalid NuGet version on build server

I updated to VS2015 this week and along with that updated all NuGet packages in my website solution.
The site builds and run fine locally, however when doing my gated check in to my build server, I get the following when the build fails
As you can see the packages are complaining about the NuGet version, but I'm unsure how to update the NuGet version on the build server. I do have admin privileges to the server, but following the guild described at: http://blog.stangroome.com/2014/02/04/update-nuget-exe-version-used-by-team-build-2013-package-restore/ did not help. For one, my folder was actually C:\Program Files\Microsoft Team Foundation Server 11.0\Tools unlike the C:\Program Files\Microsoft Team Foundation Server 12.0\Tools described in the guide, but additionally I did not have a NuGet.exe within the folder.
I've done a full hard drive search of NuGet.exe, but could not locate it in any directories aside from the directories that are directly related to project source code (.nuget\NuGet.exe).
I have opened visual studio on the server and updated the NuGet version within "Extension and Updates" hoping that would fix the issue, unfortunately it did not.
Any ideas on how to fix the issue/errors presented in the screenshot?
The problem is that you're using the old-style, deprecated-since-NuGet 2.7-style "package restore" that's based on modifying your CSProj files to include references to a NuGet.targets file and a copy of NuGet.exe that gets put into a .nuget folder and ends up source controlled.
Basically, the version of nuget.exe that's on the build server is irrelevant right now -- your CSProj files are pointing to the file in your .nuget folder.
TFS 2013 and beyond has support for automatic package restore without using the NuGet.targets method. You can migrate off of it pretty easily: https://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore

TeamCity Missing Items in Work Directory Checkouts

I've been pouring over my set up for what feels like most of the day and I cannot figure out what I'm doing wrong.
I have 3 build configurations running on a single agent on my dev box. Checking out code from SVN.
I've got OctPack installed to create a couple of packages for deployment. In addition to this I've created a nuspec file to use in a NuGet Pack step. All of these bits work fine when testing.
The problem is that the nuspec file packages up some sql script files for deployment. Nothing fancy.
The problem is these sql files are disappearing from disk in the work folder. I get:
Cannot start build runner: Failed to find files to create packages matching: [src\database\SqlScriptsPackage.nuspec] under H:\TeamCity-Build\work\a1dbf81458fbab0a.
The entire database directory is empty despite all the contents being in SVN.
I've tried everything I can think of, including a forcing a clean checkout.
All the projects are using the same VCS Root setup to checkout "Automatically on server".
What could be ditching all these files?
Disable the [] Clean output directory checkbox on the NuGet Pack step.
I had this issue where I set the target directory for the Nuget pack step to be the same folder as the .csproj file I was building from.
With the tickbox ticked, it wiped the entire directory immediatly after checking it out.
I had a similar error when running on TeamCity:
Failed to find files to create packages matching: [myProject/myProject.nuspec]
under {C:\TeamCity\work\XXXXXXXXXX}
The key for us was that reading this message you could interpret it as it cannot find the files to go in the nuget package.
However, the issue was that it cannot find the .nuspec file.
So this then helped us look at the TeamCity working directory and what we were missing to get to the 'myProject' .nuspec path above.
Another thing to check is that you have the Octopack nuget package installed in your Visual Studio project. I forgot to do this with one of my projects and received the "Failed to find files to create packages matching" error. More information is available here:
http://help.octopusdeploy.com/discussions/questions/2304-teamcity-804-not-creating-nuget-packages

What is the packages directory in Visual Studio? Should I include it in SVN?

I'm working with ASP.NET MVC 4 in Visual Studio 2010 for the first time, and I control source code with SVN. I used to work with MVC 1 in Visual Studio 2008, where I had my own filter for svn:ignore
*.pdb
*.exe
*.dll
debug/*
release/*
*.user
*.suo
obj/*
bin/*
obj
bin
VSMacros80
Thumbs.db
_ReSharper.*
but it doesn't apply in the same way now because the project has some new folders, as the packages folder, and I don't know which of them must be versioned.
About the packages folder, should I include it the repository or this folder must be ignored? What other folders or files should I ignore?
It sounds like you are using NuGet and the packages folder is the NuGet packages folder. You can commit this to source control if you do not mind adding several large but infrequently changing binaries.
Alternatively, you can omit it from source control and configure NuGet to download packages on each build if developers and the build machine are to download it as required. This also runs the danger of someone downloading a newer version and causing conflicts.
As for other files to exclude form source control, see What .net files should be excluded from source control? and For a .Net project, what file extensions should I exclude from source control?.

Resources