如果您尝试从使用 Visual Studio 制作的解决方案的顶级目录中的命令行运行:
dotnet build
我的解决方案是这样架构的:
MySolution.sln
> src
> MyProject1
> project.json
> MyProject2
> project.json
> test
> MyProject.Test
> project.json
它将失败并出现以下错误:
Couldn't find 'project.json' in current directory
我如何构建解决方案而不必明确指定每个项目(然后没有相关维护)?
最佳答案
.NET Core 1.0 预览版 (project.json)
您可以使用顶级目录(.sln 所在的位置)中的通配符。
project.json
在 SolutionDir/Src/ProjectName
:dotnet build */**/project.json
project.json
在 SolutionDir/ProjectName
:dotnet build **/project.json
注:It's recommended to migrate to new csproj project format to get support and new features.
从 .NET Core 1.0 RTM
解决方案又回来了。
dotnet build solution.sln
在powershell中,构建当前目录下的所有csproj文件。foreach ($csproj in $(Get-ChildItem -Recurse . -Filter *.csproj) )
{
dotnet build $csproj.FullName
}
关于.net-core - .Net Core 构建解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37961691/