{"id":7551,"date":"2016-02-16T15:11:15","date_gmt":"2016-02-16T15:11:15","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/?p=7551"},"modified":"2019-02-18T18:04:49","modified_gmt":"2019-02-18T18:04:49","slug":"try-out-the-latest-c-compiler-toolset-without-waiting-for-the-next-update-of-visual-studio","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/try-out-the-latest-c-compiler-toolset-without-waiting-for-the-next-update-of-visual-studio\/","title":{"rendered":"Try out the latest C++ compiler toolset without waiting for the next update of Visual Studio"},"content":{"rendered":"<p><strong><em>Updated 22 Apr 2016: The NuGet\u00a0package is\u00a0now being uploaded daily. The payload doesn&#8217;t change every day but you should see new bug fixes and\/or feature updates every five days or so. See the blog post announcement here: <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/04\/26\/stay-up-to-date-with-the-visual-c-tools-on-nuget\">https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/04\/26\/stay-up-to-date-with-the-visual-c-tools-on-nuget<\/a>.<\/em><\/strong>\nLast November we announced a prerelease of the\u00a0<a title=\"Visual C++ Build Tools [VC Blog]\" href=\"http:\/\/blogs.msdn.com\/b\/vcblog\/archive\/2015\/11\/02\/announcing-visual-c-build-tools-2015-standalone-c-tools-for-build-environments.aspx\">Visual C++ Build Tools, a standalone C++ installer for build environments<\/a>. We asked you for feedback on the experience and truly appreciate the great response we got in blog comments and through other channels. We&#8217;ll be updating the VC++ Build Tools soon and will incorporate some of your suggestions with the update. <em>[Updated Apr 2016: The Build Tools have officially released: <a title=\"Announcing the official release of the Visual C++ Build Tools 2015\" href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/03\/31\/announcing-the-official-release-of-the-visual-c-build-tools-2015\/\">https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/03\/31\/announcing-the-official-release-of-the-visual-c-build-tools-2015\/<\/a>] <\/em>\nSome of you suggested that the VC++ Build Tools don&#8217;t go far enough toward creating a lightweight way to acquire the VC++ tools. Some folks asked for an install that works through xcopy. Others suggested we use a package manager, or even just a zip file. What&#8217;s clear from all your feedback is that many of you just want an easy way to try out the latest compiler inside Visual Studio.\nToday we&#8217;re announcing a new experiment: releasing the VC++ toolset as a NuGet package that can be added to any C++ project or solution targeting desktop. Installing this NuGet package lays down a new copy of the VC++ compiler, header files, and libraries. You can compile your code with this preview toolset and, once you&#8217;re done checking out the new tools, you can just uninstall the package and get back to the supported toolset installed with Visual Studio.\nWhy might you want to try out new tools? There&#8217;s a lot of change happening in Visual C++ today: support for new features going into the C++ 17 language such as\u00a0<a href=\"http:\/\/blogs.msdn.com\/b\/vcblog\/archive\/2015\/11\/30\/coroutines-in-visual-studio-2015-update-1.aspx\">Coroutines<\/a>, support for proposed features such as\u00a0<a href=\"http:\/\/blogs.msdn.com\/b\/vcblog\/archive\/2015\/12\/03\/c-modules-in-vs-2015-update-1.aspx\">C++ Modules<\/a>, and daily bug fixes for standards conformance. You shouldn\u2019t have to wait for the next VS Update if you&#8217;re tracking our progress on new language features or have been waiting for a conformance fix. Installing a NuGet package is the quickest way to test a new compiler.\nThe experience we&#8217;re offering through NuGet today is pretty limited: it&#8217;s just one big (226 MB) NuGet package that installs in a project or a solution. We&#8217;ve got ideas about how to make the experience better: machine-wide install, for example, or allowing you to select just one host or target architecture. We\u2019re publishing the packages manually right now but would consider automating so we can do nightly updates if that would be useful for C++ developers.\nThe NuGet package will install a compiler, headers, and libraries that override the current VS version but your project will continue to pick up the other libraries from your VS install. This package doesn&#8217;t include special-purpose libraries like ATL or MFC&#8211;those are only available through VS right now. And if you need a new version of the Windows libraries or Universal CRT you&#8217;ll have to install a new\u00a0<a href=\"https:\/\/dev.windows.com\/en-us\/downloads\">Windows Development Kit<\/a>.\nWe&#8217;d like you to try out the NuGet installer and send us feedback on where you&#8217;d like us to head with the project. You can leave comments on the blog, or send mail to us directly at <a title=\"Mail to VCNuGetTools@microsoft.com\" href=\"mailto:VCNuGetTools@microsoft.com\">VCNuGetTools@microsoft.com<\/a>. This is a prerelease project so we can&#8217;t officially support it, but we&#8217;re happy to help out where possible.<\/p>\n<h2>Installing the Preview VC++ Toolset in a C++ Project or Solution<\/h2>\n<p>For those of you who are familiar with using NuGet in Visual Studio, the server is located here:\u00a0<a href=\"http:\/\/vcppdogfooding.azurewebsites.net\/nuget\">https:\/\/vcppdogfooding.azurewebsites.net\/nuget<\/a>. There&#8217;s only one package at the moment so just browse the feed and you&#8217;re sure to find it.\nIf you need a more detailed walkthrough, read on. Right now you can only install the NuGet package locally in a project or solution. Just right-click on the project or solution\u00a0and select Manage NuGet Packages.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/16.png\"><img decoding=\"async\" width=\"300\" height=\"275\" class=\"alignnone size-medium wp-image-7672\" alt=\"1\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/16-300x275.png\" \/><\/a>\nBecause these packages aren&#8217;t located on NuGet.org you&#8217;ll have to set up a new Package Source. Click on the gear icon on the top right of the dialog:\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/28.png\"><img decoding=\"async\" width=\"300\" height=\"56\" class=\"alignnone size-medium wp-image-7682\" alt=\"2\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/28-300x56.png\" \/><\/a>\nThis will bring up the Options dialog open to Package Sources. Click on the\u00a0<strong>+<\/strong>\u00a0button add a new package. Once you&#8217;ve done this, you&#8217;ll have to edit the Name and Source on the bottom of the dialog. Enter any name you like, but make sure the source is http:\/\/vcppdogfooding.azurewebsites.net\/nuget\/. Hitting the\u00a0OK\u00a0button will close the dialog and bring you back to the NuGet package manager.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/36.png\"><img decoding=\"async\" width=\"300\" height=\"176\" class=\"alignnone size-medium wp-image-7681\" alt=\"3\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/36-300x176.png\" \/><\/a>\nSelect your new Package Source at the top of the dialog and click on the Browse tab.\u00a0<strong>Make sure to click the Include prerelease checkbox<\/strong>\u00a0or you won&#8217;t see anything. Once the package manager connects to the server, you should see a package called VisualCppTools. Select it and click the\u00a0Install\u00a0button on the right. Click through the next few dialogs (making sure to carefully review the license on the second dialog) and your NuGet package will install.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/45.png\"><img decoding=\"async\" width=\"300\" height=\"213\" class=\"alignnone size-medium wp-image-7691\" alt=\"4\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/45-300x213.png\" \/><\/a>\nWhen you rebuild your project or solution you&#8217;ll be using the preview C++ toolset. Nothing else will have changed in the developer experience\u2014IntelliSense, source browsing, debugging should all be the same. You\u2019re just using new compilers and libraries. When you want to go back to the officially supported toolset that came with Visual Studio, just go back to the NuGet Package Manager dialog and select the Installed tab. There you&#8217;ll be able to uninstall the preview toolset entirely.<\/p>\n<h2>Installing the Preview VC++ Toolset with the VC++ Build Tools SKU<\/h2>\n<p>Are you using the VC++ Build Tools SKU? It&#8217;s a little more work for you to try out the preview toolset but it&#8217;s easily done. Here&#8217;s how you can do it.\nFirst, you need to get the NuGet command-line tool. Both the download link and documentation are at this link: <a href=\"https:\/\/docs.nuget.org\/consume\/command-line-reference\">https:\/\/docs.nuget.org\/consume\/command-line-reference<\/a>. When you run nuget.exe you&#8217;ll need to supply a source parameter pointing to the server and the -Prerelease switch on any commands.\nHere&#8217;s the command to install the preview toolset (command shown in <span style=\"color: blue\">blue<\/span> with output in black):<\/p>\n<pre><span style=\"color: blue\">C:\\tmp&gt;nuget install VisualCppTools -source https:\/\/vcppdogfooding.azurewebsites.net\/nuget\/ -Prerelease<\/span>\nFeeds used:\nhttps:\/\/vcppdogfooding.azurewebsites.net\/nuget\/\nAttempting to gather dependencies information for package 'VisualCppTools.14.0.23811-Pre' with respect to project 'C:\\tmp', targeting 'Any,Version=v0.0'\nAttempting to resolve dependencies for package 'VisualCppTools.14.0.23811-Pre' with DependencyBehavior 'Lowest'\nResolving actions to install package 'VisualCppTools.14.0.23811-Pre'\nResolved actions to install package 'VisualCppTools.14.0.23811-Pre'\nAdding package 'VisualCppTools.14.0.23811-Pre' to folder 'C:\\tmp'\nAdded package 'VisualCppTools.14.0.23811-Pre' to folder 'C:\\tmp'\nSuccessfully installed 'VisualCppTools 14.0.23811-Pre' to C:\\tmp'<\/pre>\n<p>Lastly, if you&#8217;re using the Visual C++ Build Tools Command Prompts, you&#8217;ll have to edit them to point to the\u00a0preview&#8217;s install directory. The easiest way to do this is to edit the file <code>vcbuildtools.bat<\/code> that you&#8217;ll find in the same directory as the Build Tools Command Prompts. On my system, they&#8217;re at <code>\\Program Files (x86)\\Microsoft Visual C++ Build Tools<\/code>. If your Build Tools are installed there as well you&#8217;ll need to run your editor with Administrator privileges (e.g., search for Notepad, right click, and select Run as Administrator.)\nThere&#8217;s a lot of fancy command script in that batch file but you only need to add one line. It overrides the <code>VCInstallDir<\/code> environment variable after the script pulls it out of the registry. Here&#8217;s the top of my file, customized to my install directory of <code>c:\\tmp<\/code>, with the line I added in <span style=\"color: blue\">blue<\/span>:<\/p>\n<pre>@echo off\nset curDir=%~dp0\n@call :GetWindowsSdkDir\n@call :GetWindowsSdkExecutablePath32\n@call :GetWindowsSdkExecutablePath64\n@call :GetExtensionSdkDir\n@call :GetVCInstallDir\n@call :GetUniversalCRTSdkDir\n<span style=\"color: blue\">set VCInstallDir=C:\\tmp\\VisualCppTools.14.0.23811-Pre\\lib\\native\\<\/span>\nif not \"%UniversalCRTSdkDir%\" == \"\" @set UCRTContentRoot=%UniversalCRTSdkDir%\nif not exist \"%~dp0..\\MSBuild\\Microsoft.Cpp\\v4.0\\v140\\\" goto error_no_VCTARGETS\ncd \"%~dp0..\\MSBuild\\Microsoft.Cpp\\v4.0\\v140\\\"\nset VCTargetsPath=%cd%\\\ncd %curDir%\n<\/pre>\n<p>Note that you can&#8217;t just override <code>VCInstallDir<\/code> on the command line because the script builds other environment variables on top of <code>VCInstallDir<\/code>. And yes, it would be more efficient to stop setting the <code>VCInstallDir<\/code> environment variable when we&#8217;re just going to override it, but I&#8217;ll leave that as an exercise for the reader.\nAfter you&#8217;ve installed the package and edited your <code>vcbuildtools.bat<\/code>, running any of the Build Tools Command Prompts should result in the preview toolset being invoked. You can verify this easily by running <code>cl -Bv<\/code> to show the version of the compiler and the location from where it is running:<\/p>\n<pre>C:\\Program Files (x86)\\Microsoft Visual C++ Build Tools&gt;<span style=\"color: blue\">cl -Bv<\/span>\nMicrosoft (R) C\/C++ Optimizing Compiler Version 19.00.23811 for x86\nCopyright (C) Microsoft Corporation.  All rights reserved.\nCompiler Passes:\n C:\\tmp\\VisualCppTools.14.0.23811-Pre\\lib\\native\\bin\\cl.exe:        Version 19.00.23811.0\n C:\\tmp\\VisualCppTools.14.0.23811-Pre\\lib\\native\\bin\\c1.dll:        Version 19.00.23811.0\n C:\\tmp\\VisualCppTools.14.0.23811-Pre\\lib\\native\\bin\\c1xx.dll:      Version 19.00.23811.0\n C:\\tmp\\VisualCppTools.14.0.23811-Pre\\lib\\native\\bin\\c2.dll:        Version 19.00.23811.0\n C:\\tmp\\VisualCppTools.14.0.23811-Pre\\lib\\native\\bin\\link.exe:      Version 14.00.23811.0\n C:\\tmp\\VisualCppTools.14.0.23811-Pre\\lib\\native\\bin\\mspdb140.dll:  Version 14.00.23811.0\n C:\\tmp\\VisualCppTools.14.0.23811-Pre\\lib\\native\\bin\\1033\\clui.dll: Version 19.00.23811.0\ncl : Command line error D8003 : missing source filename\n<\/pre>\n<h2>In closing<\/h2>\n<p>Please try out the tools and let us know what you think! We&#8217;re excited about where this project could go but we can&#8217;t do it without your ideas and suggestions on how you would use VC++ tools delivered through NuGet in your work or project. Please leave comments on this blog post or send us mail at\u00a0<a href=\"mailto:VCNuGetTools@microsoft.com\">VCNuGetTools@microsoft.com<\/a>. Thank you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Updated 22 Apr 2016: The NuGet\u00a0package is\u00a0now being uploaded daily. The payload doesn&#8217;t change every day but you should see new bug fixes and\/or feature updates every five days or so. See the blog post announcement here: https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/04\/26\/stay-up-to-date-with-the-visual-c-tools-on-nuget. Last November we announced a prerelease of the\u00a0Visual C++ Build Tools, a standalone C++ installer for build [&hellip;]<\/p>\n","protected":false},"author":312,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[240,59],"class_list":["post-7551","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus","tag-installation","tag-platform-toolset"],"acf":[],"blog_post_summary":"<p>Updated 22 Apr 2016: The NuGet\u00a0package is\u00a0now being uploaded daily. The payload doesn&#8217;t change every day but you should see new bug fixes and\/or feature updates every five days or so. See the blog post announcement here: https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/04\/26\/stay-up-to-date-with-the-visual-c-tools-on-nuget. Last November we announced a prerelease of the\u00a0Visual C++ Build Tools, a standalone C++ installer for build [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/7551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/312"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=7551"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/7551\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=7551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=7551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=7551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}