在不使用 Visual Studio 的情况下将基于 project.json 的项目添加到 .sln 文件
Add a project.json based project to a .sln file without using Visual Studio
我们有开发人员在 Linux、Windows 和 Mac 上使用 VS Code。我们也有开发人员在 Windows 上使用完整的 Visual Studio。当前者(包括我)没有将他们的项目添加到解决方案中时,就会出现问题,而后者因此在解决方案中看不到项目。
开发人员如何在不打开 Visual Studio 的情况下将他们的 project.json 项目添加到 sln
?
现在 .NET Core SDK 允许使用 sln 文件。
假设您有一个解决方案的根文件夹。所有项目都位于 src 和 test 文件夹下。
然后从解决方案文件夹 运行 像这样:
dotnet sln add ./src/Insurance.Domain/Insurance.Domain.csproj
dotnet sln add ./test/Insurance.Domain.Tests/Insurance.Domain.Tests.csproj
您可以列出解决方案中的项目 运行ing
dotnet sln list
注:
上面提供的解决方案不适用于 project.json 文件。无论如何 project.json 格式现在已经过时,您可以使用最新的 SDK 轻松迁移到 csprojs。只需 运行 在您的项目文件夹中:
dotnet migrate
一切顺利。
我们有开发人员在 Linux、Windows 和 Mac 上使用 VS Code。我们也有开发人员在 Windows 上使用完整的 Visual Studio。当前者(包括我)没有将他们的项目添加到解决方案中时,就会出现问题,而后者因此在解决方案中看不到项目。
开发人员如何在不打开 Visual Studio 的情况下将他们的 project.json 项目添加到 sln
?
现在 .NET Core SDK 允许使用 sln 文件。
假设您有一个解决方案的根文件夹。所有项目都位于 src 和 test 文件夹下。
然后从解决方案文件夹 运行 像这样:
dotnet sln add ./src/Insurance.Domain/Insurance.Domain.csproj
dotnet sln add ./test/Insurance.Domain.Tests/Insurance.Domain.Tests.csproj
您可以列出解决方案中的项目 运行ing
dotnet sln list
注: 上面提供的解决方案不适用于 project.json 文件。无论如何 project.json 格式现在已经过时,您可以使用最新的 SDK 轻松迁移到 csprojs。只需 运行 在您的项目文件夹中:
dotnet migrate
一切顺利。