Try out the latest C++ compiler toolset without waiting for the next update of Visual Studio

来源:http://www.cnblogs.com/roucheng/archive/2016/05/06/cppbianyiqi.html
-Advertisement-
Play Games

Updated 22/Apr/2016: The NuGet package is now being uploaded daily. The payload doesn’t change every day but you should see new bug fixes and/or featu ...


Updated 22/Apr/2016: The NuGet package is now being uploaded daily. The payload doesn’t change every day but you should see new bug fixes and/or feature updates every five days or so. Look for a blog post on this topic soon!

Last November we announced a prerelease of the Visual C++ Build Tools, a standalone C++ installer for build environments. We asked you for feedback on the experience and truly appreciate the great response we got in blog comments and through other channels. We’ll be updating the VC++ Build Tools soon and will incorporate some of your suggestions with the update. 

Some of you suggested that the VC++ Build Tools don’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’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.

Today we’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’re done checking out the new tools, you can just uninstall the package and get back to the supported toolset installed with Visual Studio.

Why might you want to try out new tools? There’s a lot of change happening in Visual C++ today: support for new features going into the C++ 17 language such as Coroutines, support for proposed features such as C++ Modules, and daily bug fixes for standards conformance. You shouldn’t have to wait for the next VS Update if you’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.

The experience we’re offering through NuGet today is pretty limited: it’s just one big (226 MB) NuGet package that installs in a project or a solution. We’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’re publishing the packages manually right now but would consider automating so we can do nightly updates if that would be useful for C++ developers.

The 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’t include special-purpose libraries like ATL or MFC–those are only available through VS right now. And if you need a new version of the Windows libraries or Universal CRT you’ll have to install a new Windows Development Kit.

We’d like you to try out the NuGet installer and send us feedback on where you’d like us to head with the project. You can leave comments on the blog, or send mail to us directly at [email protected]. This is a prerelease project so we can’t officially support it, but we’re happy to help out where possible.

Installing the Preview VC++ Toolset in a C++ Project or Solution

For those of you who are familiar with using NuGet in Visual Studio, the server is located here: http://vcppdogfooding.azurewebsites.net/nuget. There’s only one package at the moment so just browse the feed and you’re sure to find it.

If 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 and select Manage NuGet Packages.

Because these packages aren’t located on NuGet.org you’ll have to set up a new Package Source. Click on the gear icon on the top right of the dialog:

2

This will bring up the Options dialog open to Package Sources. Click on the + button add a new package. Once you’ve done this, you’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 OK button will close the dialog and bring you back to the NuGet package manager.

3

Select your new Package Source at the top of the dialog and click on the Browse tab. Make sure to click the Include prerelease checkbox or you won’t see anything. Once the package manager connects to the server, you should see a package called VisualCppTools. Select it and click the Install button 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.

When you rebuild your project or solution you’ll be using the preview C++ toolset. Nothing else will have changed in the developer experience—IntelliSense, source browsing, debugging should all be the same. You’re 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’ll be able to uninstall the preview toolset entirely.

Installing the Preview VC++ Toolset with the VC++ Build Tools SKU

Are you using the VC++ Build Tools SKU? It’s a little more work for you to try out the preview toolset but it’s easily done. Here’s how you can do it.

First, you need to get the NuGet command-line tool. Both the download link and documentation are at this link:https://docs.nuget.org/consume/command-line-reference. When you run nuget.exe you’ll need to supply a source parameter pointing to the server and the -Prerelease switch on any commands.

Here’s the command to install the preview toolset (command shown in blue with output in black):

C:\tmp>nuget install VisualCppTools -source http://vcppdogfooding.azurewebsites.net/nuget/ -Prerelease
Feeds used:

http://vcppdogfooding.azurewebsites.net/nuget/

Attempting to gather dependencies information for package 'VisualCppTools.14.0.23811-Pre' with respect to project 'C:\tmp', targeting 'Any,Version=v0.0'
Attempting to resolve dependencies for package 'VisualCppTools.14.0.23811-Pre' with DependencyBehavior 'Lowest'
Resolving actions to install package 'VisualCppTools.14.0.23811-Pre'
Resolved actions to install package 'VisualCppTools.14.0.23811-Pre'
Adding package 'VisualCppTools.14.0.23811-Pre' to folder 'C:\tmp'
Added package 'VisualCppTools.14.0.23811-Pre' to folder 'C:\tmp'
Successfully installed 'VisualCppTools 14.0.23811-Pre' to C:\tmp'

Lastly, if you’re using the Visual C++ Build Tools Command Prompts, you’ll have to edit them to point to the preview’s install directory. The easiest way to do this is to edit the file vcbuildtools.bat that you’ll find in the same directory as the Build Tools Command Prompts. On my system, they’re at \Program Files (x86)\Microsoft Visual C++ Build Tools. If your Build Tools are installed there as well you’ll need to run your editor with Administrator privileges (e.g., search for Notepad, right click, and select Run as Administrator.)

There’s a lot of fancy command script in that batch file but you only need to add one line. It overrides the VCInstallDir environment variable after the script pulls it out of the registry. Here’s the top of my file, customized to my install directory of c:\tmp, with the line I added in blue:

@echo off

set curDir=%~dp0

@call :GetWindowsSdkDir
@call :GetWindowsSdkExecutablePath32
@call :GetWindowsSdkExecutablePath64
@call :GetExtensionSdkDir
@call :GetVCInstallDir
@call :GetUniversalCRTSdkDir
set VCInstallDir=C:\tmp\VisualCppTools.14.0.23811-Pre\lib\native\

if not "%UniversalCRTSdkDir%" == "" @set UCRTContentRoot=%UniversalCRTSdkDir%
if not exist "%~dp0..\MSBuild\Microsoft.Cpp\v4.0\v140\" goto error_no_VCTARGETS
cd "%~dp0..\MSBuild\Microsoft.Cpp\v4.0\v140\"
set VCTargetsPath=%cd%\
cd %curDir%

Note that you can’t just override VCInstallDir on the command line because the script builds other environment variables on top ofVCInstallDir. And yes, it would be more efficient to stop setting the VCInstallDir environment variable when we’re just going to override it, but I’ll leave that as an exercise for the reader.

After you’ve installed the package and edited your vcbuildtools.bat, running any of the Build Tools Command Prompts should result in the preview toolset being invoked. You can verify this easily by running cl -Bv to show the version of the compiler and the location from where it is running:

C:\Program Files (x86)\Microsoft Visual C++ Build Tools>cl -Bv
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23811 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

Compiler Passes:
 C:\tmp\VisualCppTools.14.0.23811-Pre\lib\native\bin\cl.exe:        Version 19.00.23811.0
 C:\tmp\VisualCppTools.14.0.23811-Pre\lib\native\bin\c1.dll:        Version 19.00.23811.0
 C:\tmp\VisualCppTools.14.0.23811-Pre\lib\native\bin\c1xx.dll:      Version 19.00.23811.0
 C:\tmp\VisualCppTools.14.0.23811-Pre\lib\native\bin\c2.dll:        Version 19.00.23811.0
 C:\tmp\VisualCppTools.14.0.23811-Pre\lib\native\bin\link.exe:      Version 14.00.23811.0
 C:\tmp\VisualCppTools.14.0.23811-Pre\lib\native\bin\mspdb140.dll:  Version 14.00.23811.0
 C:\tmp\VisualCppTools.14.0.23811-Pre\lib\native\bin\1033\clui.dll: Version 19.00.23811.0

cl : Command line error D8003 : missing source filename

In closing

Please try out the tools and let us know what you think! We’re excited about where this project could go but we can’t do it without your ideas and suggestions on how you would use VC++ tools delivered through NuGet in your work or project. 

http://www.cnblogs.com/roucheng/p/cpptimu.html


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 採用gradle構建和發佈bboss版本及從maven中央庫下載bboss方法介紹 1.概述 bboss是國內最早採用gradle來構建和發佈版本的開源框架之一,那麼gradle是個什麼東東?以下公式可以大概表述一下意思: gradle=ant+maven 尤其是通過gretty插件直接可以在ecl ...
  • A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its inde ...
  • 如果有介面,寫在介面方法上即可。滑鼠滑過方法名時時會顯示 如果沒有介面,寫在每個方法上方。 eclipse 分三步 ① 找到方法,並將游標移動至方法名的上方 ②/** ③回車 那,效果是醬紫 ...
  • 本來用之前也過的堆直接實現比較好,這裡我直接重新寫一了函數融入進去了 註釋部分的代碼,是用來進行哈夫曼編碼的,這種編碼方式就不需要使用三叉鏈的樹了(帶有parent指針的三叉樹) ...
  • 05年第一次接觸要做彩票項目的客戶,見面談了下,客戶給了一些各彩種各玩法的獎金文檔,並給了一個正在運營的彩票網站,客戶要求我們對照功能上評估工作量然後報價。 半個月後再次見面,通過評估後報價7W(當時客戶只要求做,重慶、天津、江西以及廣東、江西、山東11選、福彩3D、上海時時樂、北京快樂8)。敲定價 ...
  • 好書不能只讀一遍,這兩天又翻看了一遍《你必須知道的.NET》,重溫了下基礎,重溫了下經典,簡單記錄了下來。 記憶體分配:CLR 管理記憶體的區域,主要有三塊,分別為: 線程的堆棧,用於分配值類型實例。堆棧主要由操作系統管理,而不受垃圾收集器的控制,當值類型實例所在方法結束時,其存儲單位自動釋放。棧的執行 ...
  • 剛開始接觸.NET很疑惑,看完視頻也不是太懂,通過總結和反覆,從概括和概念入手,慢慢變得清晰了。這篇博客主要是我對.NET基礎知識的瞭解,算作積累吧。 .NET框架體繫結構 由四個主要部分組成 公共語言運行時(CLR)是.NET框架應用程式的執行引擎..NET框架的關鍵作用在於,它提供了一個跨編程語 ...
  • 詳細步驟 創建文件夾,規劃好項目目錄 創建相關實體類 (Data Model) 創建 Database Context 創建Initializer, 使用EF初始化資料庫,插入測試數據 實現資料庫登錄驗證 總結 一,創建文件夾,規劃好項目目錄 1.根目錄下新建一個 ViewModels文件夾: Mo ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...