惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Latest
Security Latest
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
Threatpost
NISL@THU
NISL@THU
A
Arctic Wolf
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Tenable Blog
O
OpenAI News
Know Your Adversary
Know Your Adversary
Google Online Security Blog
Google Online Security Blog
Cloudbric
Cloudbric
PCI Perspectives
PCI Perspectives
爱范儿
爱范儿
GbyAI
GbyAI
U
Unit 42
IT之家
IT之家
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
罗磊的独立博客
Last Week in AI
Last Week in AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
AWS News Blog
AWS News Blog
Schneier on Security
Schneier on Security
L
LINUX DO - 最新话题
Latest news
Latest news
Hacker News: Ask HN
Hacker News: Ask HN
W
WeLiveSecurity
TaoSecurity Blog
TaoSecurity Blog
Attack and Defense Labs
Attack and Defense Labs
Scott Helme
Scott Helme
Security Archives - TechRepublic
Security Archives - TechRepublic
S
Securelist
Help Net Security
Help Net Security
C
Cybersecurity and Infrastructure Security Agency CISA
V
V2EX
S
Security @ Cisco Blogs
月光博客
月光博客
P
Proofpoint News Feed
B
Blog RSS Feed
The GitHub Blog
The GitHub Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hugging Face - Blog
Hugging Face - Blog
L
LangChain Blog
博客园 - 叶小钗
C
Check Point Blog
腾讯CDC
The Cloudflare Blog
Simon Willison's Weblog
Simon Willison's Weblog

C++ Team Blog

Pure Virtual C++ 2026 Is a Wrap - C++ Team Blog Pure Virtual C++ 2026 Is Now Live! - C++ Team Blog C++ Dependencies Without the Headache: vcpkg + Copilot CLI - C++ Team Blog Pure Virtual C++ 2026 Is Tomorrow and On-Demand Sessions Are Now Available - C++ Team Blog Faster C++ iterative builds with GitHub Copilot - C++ Team Blog Pure Virtual C++ 2026 [Meet the Speakers, Part 3]: Modernizing C++ - C++ Team Blog MSVC Build Tools Preview updates - July 2026 - C++ Team Blog Rethinking C++ Performance: Faster Code Navigation and GitHub Copilot Tools with Whole Codebase Indexing - C++ Team Blog Pure Virtual C++ 2026 [Meet the Speakers, Part 2]: The AI-Native C++ Developer Workflow - C++ Team Blog Pure Virtual C++ 2026 [Meet the Speakers, Part 1]: Build Faster, Run Faster - C++ Team Blog What's New in vcpkg (June 2026) - C++ Team Blog Pure Virtual C++ 2026 Talks Announced - C++ Team Blog Save the Date: Pure Virtual C++ 2026 - C++ Team Blog Streamline C++ Code Intelligence Setup in Copilot CLI - C++ Team Blog Boosting Adobe Photoshop’s Performance with MSVC and SPGO - C++ Team Blog GitHub Copilot modernization for C++ is out of preview MSVC Build Tools Preview updates – June 2026 What’s New in vcpkg (May 2026) What’s New for C++ Developers in Visual Studio 2026 (18.1 – 18.6) Introducing Sample Profile Guided Optimization in MSVC Segment Heap support for C++ projects in Visual Studio MSVC Build Tools Preview updates – May 2026 MSVC Build Tools version 14.51 (GA) now available Project-Specific Build Optimizations with GitHub Copilot What's New in vcpkg (Apr 2026) - C++ Team Blog Giving Copilot more C++ context using custom instructions in VS Code Take the 2026 ISO C++ Developer Survey! - C++ Team Blog C++ Code Intelligence for GitHub Copilot CLI (Preview) - C++ Team Blog MSVC Build Tools Version 14.51 Release Candidate Now Available C++23 Support in MSVC Build Tools 14.51 What’s New in vcpkg (Feb 2026 – Mar 2026): Parallel file installation and more! Visual Studio at GDC Festival of Gaming 2026 C++ Performance Improvements in MSVC Build Tools v14.51 C++ symbol context and CMake build configuration awareness for GitHub Copilot in VS Code Microsoft C++ (MSVC) Build Tools v14.51 Preview Released: How to Opt In What’s New in vcpkg (Nov 2025 – Jan 2026) MSVC Build Tools Versions 14.30 – 14.43 Now Available in Visual Studio 2026 GitHub Copilot app modernization for C++ is now in Public Preview Visual Studio Code CMake Tools 1.22: Target bookmarks and better CTest output
NuGet PackageReference for C++ Projects in Visual Studio
Augustin Popa · 2026-05-19 · via C++ Team Blog

Native C++ projects in Visual Studio now support <PackageReference>, the modern, MSBuild-native way to declare NuGet package dependencies directly in your project file. This support is available experimentally for .vcxproj projects in the Visual Studio Insiders Channel starting with version 18.7.

This feature has been the most upvoted feature request on Visual Studio Developer Community, and we’re delivering it based on that feedback and in collaboration with other teams at Microsoft, including Windows and Azure.

NuGet with PackageReferences can be useful for teams that develop both .NET and C++ projects (native or interop) that need a consistent way to deploy their binaries across their repos or to their consumers, or for managing dependencies that aren’t C++ libraries, such as binary SDK packages. We continue to recommend vcpkg for acquiring and managing C++ libraries, as it is more specialized and flexible for these types of dependencies.

What Is PackageReference?

Traditionally, NuGet packages in C++ projects were managed through packages.config, a separate XML file that listed every dependency (including transitive ones) and required a per-solution packages folder. PackageReference eliminates that by declaring dependencies directly in the project file:

<ItemGroup>
  <PackageReference Include="Microsoft.Windows.CppWinRT" Version="2.0.240405.15" />
</ItemGroup>

The key advantages over packages.config:

  • Single source of truth. Dependencies live in the project file alongside your other project references. No separate files required.
  • Transitive dependency resolution. You only list packages you directly depend on. NuGet resolves the rest automatically at restore time.
  • Global package cache. Packages are stored once on disk in a global folder, not duplicated per-solution. This means faster restores and less disk usage.
  • MSBuild integration. You can use conditions to vary package references by configuration, platform, or target framework, using the same MSBuild syntax you already know.

For a full overview, see the PackageReference documentation on Microsoft Learn. If you’re migrating an existing project, see Migrate from packages.config to PackageReference.

How It Works

Once enabled, this experience is identical to .NET projects, both in the Visual Studio IDE and on the command line. There is no difference in the core UX. You can add PackageReferences by:

  1. Editing the project file directly. Add <PackageReference> items to an <ItemGroup> in your .vcxproj.
  2. Using the NuGet Package Manager UI. Right-click your project in Solution Explorer, select Manage NuGet Packages, and install packages as usual.
  3. Using the Package Manager Console. Run Install-Package commands.

NuGet restore handles downloading, caching, and making package assets available to your build. The underlying implementation uses core CPS (Common Project System) capabilities, the same infrastructure that powers this feature for .NET projects.

How to Enable It

This feature is experimental and off by default in version 18.7. To opt in, set the EnableNativePackageReferenceSupport MSBuild property to true.

You can do this in your project file’s Globals property group:

<PropertyGroup Label="Globals">
  <EnableNativePackageReferenceSupport>true</EnableNativePackageReferenceSupport>
</PropertyGroup>

Or, to enable it across all projects in a repository, add it to a Directory.Build.props file:

<Project>
  <PropertyGroup>
    <EnableNativePackageReferenceSupport>true</EnableNativePackageReferenceSupport>
  </PropertyGroup>
</Project>

Performance

We designed this feature to be fully compatible with the project load performance improvements shipped since Visual Studio 2017. One of the things holding us back from shipping PackageReference in the past was that a simpler implementation would invalidate this work, causing ongoing performance regressions for customers. Happily, this problem is now solved. The first time you add PackageReferences to a project, there is a one-time cache warm-up cost. After that initial load, the cache is warm and subsequent project operations are fully optimized with no ongoing performance impact.

Current Limitations

This initial release supports native C++ projects (.vcxproj). The following scenarios are not yet supported:

  • C++/CLI projects targeting legacy .NET Framework versions. (PackageReference for C++/CLI projects targeting modern .NET is already supported; see our earlier announcement.)
  • C++ projects that reference C++/CLI projects or C# projects. We are investigating a solution to this. In the meantime, you can use one of these workarounds:
    • Set <ReferenceOutputAssembly>false</ReferenceOutputAssembly> and <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties> on the <ProjectReference> item, which will allow NuGet to ignore it and not cause restore and build issues.
    • Set AssetTargetFallback to include frameworks compatible with the referenced C# project. For example:
      <PropertyGroup>
      <AssetTargetFallback>net472;net10.0</AssetTargetFallback>
      </PropertyGroup>

What About vcpkg?

This feature does not change our recommendation for vcpkg. We continue to recommend vcpkg as the primary tool for acquiring and managing C and C++ libraries. vcpkg provides source-based builds with binary caching support, ABI compatibility management, support for offline installation, and a curated registry of thousands of open-source libraries optimized for C++ workflows.

PackageReference support complements vcpkg by enabling NuGet-based distribution workflows. For example, teams that publish internal SDK packages via NuGet feeds, or projects that consume Windows-specific packages distributed through NuGet.org. The two tools serve different use cases and work well together. You can also use vcpkg to build library dependencies, then export them as NuGet with the vcpkg export --nuget command.

Try It Out

  1. Download Visual Studio Insiders.
  2. Enable the feature by setting EnableNativePackageReferenceSupport to true in your project or Directory.Build.props.
  3. Add a PackageReference to your .vcxproj and build.

We want your feedback. This is an experimental release, and your input will directly shape how we evolve this feature before enabling it by default. Let us know:

  • Does the end-to-end experience work well for your projects?
  • Are there gaps or rough edges you encounter?
  • How does performance feel in your solutions?

You can share feedback through Developer Community, the blog comments below, or Help → Send Feedback in Visual Studio.

Category

Topics

Author

Augustin Popa

Product manager on the Microsoft C++ team working on Visual Studio, MSVC Build Tools, and vcpkg.