安装在我的机器上是:奇怪的生成错误的.Net核心项目
- 的Visual Studio Pro中2015年
- 的Visual Studio 2015年更新3
- .NET核心1.0.1工具预览版2
注意:在Windows 10机器和Windows 7机器上会出现生成错误,但生成在另一台Windows 7机器上可以正常工作。
所以我的git克隆从另一个开发一个.net核心项目,当我尝试建立在Visual Studio 2015年我收到错误
“系统找不到Microsoft.DotNet.Common指定的文件。目标管线262"
围棋在C行262:\程序文件(x86)\的MSBuild \微软\ VisualStudio的\ v14.0 \ DOTNET的\ Microsoft.DotNet.Common.Targets线262我看到
<Dnx
RuntimeExe="$(SDKToolingExe)"
Condition="'$(_DesignTimeHostBuild)' != 'true'"
ProjectFolder="$(MSBuildProjectDirectory)"
Arguments="$(_BuildArguments)"
/>
如果从Microsoft.DotNet.Common.Targets项目中删除此部分建立。
我知道dnx是旧的.Net Core工具,我的猜测是类库中的project.json的东西,遗留给旧的dnx工具以及我已安装的新的1.0.1 Preview 2 .Net Core工具将旧的project.json条目推迟到Microsoft.DotNet.Common.Targets中的旧dnx工具条目,但由于我没有安装dnx工具,所以构建失败,当然,这只是一个猜测。
我已经广泛在网上搜索关于这个问题,我found an article说明把"type": "platform"
为Microsoft.NETCore.App
依赖于project.json但我没有使用依赖,我尝试添加"type": "platform"
我"NETStandard.Library"
的依赖,但没有帮助,在这里是我project.json:
{
"version": "1.0.1-*",
"dependencies":
{
"Microsoft.AspNetCore.Mvc.Abstractions": "1.1.0",
"Microsoft.AspNetCore.Mvc.Core": "1.1.0",
"NETStandard.Library": "1.6.1",
"TSO.ProductItemList.Model": "1.0.2"
},
"frameworks":
{
"netstandard1.6":
{
"imports": "dnxcore50"
}
},
"scripts":
{
"postcompile":
[
"dotnet pack --no-build --configuration %compile:Configuration%",
"\"C:\\Program Files (x86)\\NuGet\\nuget\" push \"%project:Directory%\\bin\\%compile:Configuration%\\%project:Name%.%project:Version%.nupkg\" -s http://foo/NugetServer/ -apikey testkey"
]
}
}
这里是生成输出:
1>------ Build started: Project: TSO.ProductItemList.Model, Configuration: Debug Any CPU ------
1> C:\Program Files\dotnet\dotnet.exe build "C:\projects\tsl\ProductItemList\src\TSO.ProductItemList.Model" --configuration Debug --no-dependencies
1> Project TSO.ProductItemList.Model (.NETStandard,Version=v1.6) will be compiled because project is not safe for incremental compilation. Use --build-profile flag for more information.
1> Compiling TSO.ProductItemList.Model for .NETStandard,Version=v1.6
1> Producing nuget package "TSO.ProductItemList.Model.1.0.2" for TSO.ProductItemList.Model
1> TSO.ProductItemList.Model -> C:\projects\tsl\ProductItemList\src\TSO.ProductItemList.Model\bin\Debug\TSO.ProductItemList.Model.1.0.2.nupkg
1> Producing nuget package "TSO.ProductItemList.Model.1.0.2.symbols" for TSO.ProductItemList.Model
1> TSO.ProductItemList.Model -> C:\projects\tsl\ProductItemList\src\TSO.ProductItemList.Model\bin\Debug\TSO.ProductItemList.Model.1.0.2.symbols.nupkg
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): error : The system cannot find the file specified
2>------ Build started: Project: TSO.ProductItemList.Client, Configuration: Debug Any CPU ------
2> C:\Program Files\dotnet\dotnet.exe build "C:\projects\tsl\ProductItemList\src\TSO.ProductItemList.Client" --configuration Debug --no-dependencies
2> Project TSO.ProductItemList.Client (.NETStandard,Version=v1.6) will be compiled because project is not safe for incremental compilation. Use --build-profile flag for more information.
2> Compiling TSO.ProductItemList.Client for .NETStandard,Version=v1.6
2> Producing nuget package "TSO.ProductItemList.Client.1.0.1" for TSO.ProductItemList.Client
2> TSO.ProductItemList.Client -> C:\projects\tsl\ProductItemList\src\TSO.ProductItemList.Client\bin\Debug\TSO.ProductItemList.Client.1.0.1.nupkg
2> Producing nuget package "TSO.ProductItemList.Client.1.0.1.symbols" for TSO.ProductItemList.Client
2> TSO.ProductItemList.Client -> C:\projects\tsl\ProductItemList\src\TSO.ProductItemList.Client\bin\Debug\TSO.ProductItemList.Client.1.0.1.symbols.nupkg
2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): error : The system cannot find the file specified
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
给VS 2017年一试。旧工具不再由Microsoft积极维护。 –
@LexLi VS 2015被认为是旧的工具?为什么是Microsoft Core安装说明的第一步:“下载Visual Studio 2015”? https://www.microsoft.com/net/core#windowsvs2015 –
只是因为它还没有3月7日。他们可能不想在这么短的时间内更新两次页面。 –