且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将代码文件移到项目中的另一个文件下

更新时间:2023-01-08 15:54:23

我找到了一种解决方法这样做,但这不是用户友好的操作,需要手动编辑项目文件。我不确定它是否可以在其他版本的Visual Studio中运行,然后在我的其他版本(MS Visual Studio 2013)中运行

I found one way of doing this, but it is not user-friendly and needs to edit project file by hands. I'm not sure it will work in other versions of Visual Studio then mine (MS Visual Studio 2013)

首先,卸载项目(右键单击项目,卸载项目)。

First, unload project (right-click on project, Unload Project).

然后编辑 csproj 文件(右再次单击,编辑* .csproj

Then edit csproj file (right-click again, Edit *.csproj)

在编辑器中,替换:

<Compile Include="SingleDocumentViewModel.Commands.cs">

<Compile Include="SingleDocumentViewModel.Commands.cs">
  <DependentUpon>SingleDocumentViewModel.cs</DependentUpon>
</Compile>

然后保存已编辑的文件并再次加载项目(右键单击重新加载项目)。

Then save edited file and load project again (right-click on it, Reload project).

现在文件已分组: