You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS2017添加现有项仅创建链接,无法复制文件的技术咨询

Hey there, I’ve dealt with this exact VS2017 quirk before—let’s get this sorted for you right away. The core issue here is that when you use Add->Existing Item..., Visual Studio defaults to creating a link unless you use the hidden dropdown option. Here’s how to make it copy the file to your project directory instead:

  • When you’ve found your target .cpp file in the file picker dialog, don’t click the "Add" button right away. Look closely at the right edge of the "Add" button—there’s a tiny downward arrow there.
  • Click that arrow, and you’ll see two options: Add (which creates the problematic link) and Add as Copy.
  • Pick Add as Copy, and VS will copy the file from its original location into your project’s folder, then add it as a local item to your project.

You mentioned you can’t find that dropdown arrow? It’s easy to miss because it’s small—if it’s still not showing up, try this workaround to ensure the file gets copied properly:

  1. Open File Explorer, find your .cpp file, and manually copy it into your project’s directory (the same folder where your .vcxproj project file is stored).
  2. Go back to VS2017, right-click your project in the Solution Explorer, and select Add->Existing Item....
  3. Navigate to your project’s folder, select the copied .cpp file, and click Add—this will add the local file instead of a link.

If you already added a linked file by mistake, you can fix it by:

  • Right-clicking the linked file in Solution Explorer and selecting Remove (don’t delete it from disk!).
  • Then follow the steps above to add it as a copy to your project.

This way, moving or deleting the original file won’t break your project anymore. Let me know if you run into any issues getting this to work!

内容的提问来源于stack exchange,提问作者John Spink

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 06:27:36