我使用c#和Visual Studio 2017开始了一个新项目。我的目标是管理Visual Studio中的文档,以将所有文件放在一个位置,并在TFS / Git中提供完整且易于访问的历史记录。
我在src
文件夹中有代码,在文件夹中有测试项目,在test
文件夹中有Markdown文件形式的文档docs
(我使用Markdown Editor)。根文件夹中还有一个Readme.md:
现在有一些问题:
我读过有关创建一个空的C#项目并禁用该项目的构建的信息,但这似乎也很容易。
有一些建议在Visual Studio中管理文档文件吗?
就像在这个答案中一样,可以使用Visual Studio 2017中的链接文件功能来链接整个目录,前提是您正在使用新的.csproj
项目格式,并且除了Visual Studio 2017 15.3+之外还安装了.NET Core 2.0 SDK。 。
<EmbeddedResource Include="..\..\..\docs\**\*.md" LinkBase="docs" />
这会将docs
使用项目的相对路径的子文件夹链接到名为docs
(LinkBase)的项目中的文件夹。每次添加,删除或更改文件docs
夹或嵌套文件夹中的文件时,Visual Studio都会识别更改(如果已打开,它可能会提示您更新Visual Studio中的文件)。
Note that you can use this feature on other MSBuild Project Items besides EmbeddedResource
as well, such as Content
, Compile
, or None
.
Technically, Visual Studio solution files are projects. You can see this by opening the .sln
file in a text editor:
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{4016BDAB-6C33-4D1E-9439-57B416EA45D5}"
ProjectSection(SolutionItems) = preProject
build.bat = build.bat
build\build.ps1 = build\build.ps1
src\CommonAssemblyInfo.cs = src\CommonAssemblyInfo.cs
TestTargetFramework.proj = TestTargetFramework.proj
Version.proj = Version.proj
EndProjectSection
EndProject
Unfortunately, the .sln
format doesn't provide many options. As you can see in Hack the Project and Solution Files, the ProjectSection
simply lists the dependencies of the project, and optionally has the ability to specify a "real" relative file path. But that is pretty much it. And according to this similar question, it is not possible to link a directory to another directory in a .sln
file.
上述解决方案项目“项目”和.csproj
项目之间的唯一区别是,后者将控制将文件添加到.csproj
(MSBuild)文件的位置。
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyProject",
"src\MyProject\MyProject.csproj", "{3A0AA37E-2B7B-4416-B528-DA4E0E6A6706}"
EndProject
但是,正如该答案所指出的,另一个解决方法是添加一个Web站点项目,该项目将添加一个不.csproj
包含文件的项目,该文件“实时”跟踪磁盘上的文件,类似于.csproj
Visual Studio中新格式的工作方式2017。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句