安裝在我的機器上是:奇怪的生成錯誤的.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日。他們可能不想在這麼短的時間內更新兩次頁面。 –