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

Visual Studio 2017中C#项目Markdown文档管理结构不一致问题咨询

Fixing Visual Studio 2017 Structure vs. File System Mismatch for Document Management

Hey there, let's work through this structure mismatch issue you're hitting with your Visual Studio 2017 project. I've set up similar document-managed projects with Git/TFS before, so here are actionable steps to get your VS structure aligned with your file system:

1. Explicitly Include File System Folders in Your Solution/Project

Visual Studio doesn't automatically sync every file system change to the solution explorer—you need to tell it to include your folders:

  • Right-click your solution in the Solution Explorer → Select Add > Existing Folder
  • Navigate to your src, test, and docs folders one by one and add them. This will make them visible in VS and link them to your project structure.
  • For your Markdown files, right-click any .md file → Open With > Markdown Editor (then set it as the default) to ensure they open correctly with your editor tool.

2. Use "Show All Files" to Catch Unincluded Items

If some folders/files are still missing in VS:

  • Click the Show All Files button (the eye icon) at the top of the Solution Explorer. This will display every file/folder in your project's file system, even those not yet included in the project.
  • Right-click any grayed-out folder/file you want to add → Select Include In Project. This will sync VS's view to match what's on your disk.

3. Clean Up Source Control with Ignore Rules

To keep your TFS/Git history clean and avoid tracking VS-generated junk:

  • Create a .tfignore (for TFS) or .gitignore (for Git) file in your root directory. Add these common exclusions:
    # Visual Studio 2017 temp files
    .vs/
    bin/
    obj/
    *.suo
    *.user
    *.cache
    
  • This ensures only your src, test, docs, and Readme.md get tracked in source control, keeping your history focused on meaningful changes.

4. Verify/Edit Project Files Manually (If Needed)

If the above steps don't fix the mismatch, you can tweak the project file directly:

  • Right-click your project in Solution Explorer → Unload Project
  • Right-click the unloaded project → Edit [YourProjectName].csproj
  • Check that your folders are referenced correctly in the XML. Add these lines if missing:
    <ItemGroup>
      <Folder Include="src\" />
      <Folder Include="test\" />
      <Folder Include="docs\" />
    </ItemGroup>
    
  • Save the file, then right-click → Reload Project. VS will now pick up the updated structure.

5. Keep Changes Synced in Source Control

Once your structure is aligned, make sure to commit all related files together (code, tests, docs) when you make changes. This ensures your TFS/Git history stays complete and linked—you can use Visual Studio's Team Explorer to view the full history of any file, including your Markdown docs.

内容的提问来源于stack exchange,提问作者Sammy Berg

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 03:27:59