我有以下关于解决方案的项目,这在我的本地工作得很好 .
但是,当我在Team服务中检查代码并创建构建时,它会失败 .
mainconsole.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PackageTargetFallback>portable-net45+win8</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.Portable.Compatibility" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\business\business.csproj" />
<ProjectReference Include="..\portableextensibility\portableextensibility.csproj" />
<ProjectReference Include="..\portablelibrary\portablelibrary.csproj" />
</ItemGroup>
</Project>
构建任务:
-
命令行 - 工具
dotnet
,参数 -restore
-
命令行 - 工具
dotnet
,参数 -build
构建失败:
d:\ a \ 3 \ s \ portablelibrary \ portablelibrary.csproj(43,4):错误MSB4019:导入的项目“C:\ Program Files \ dotnet \ sdk \ 1.0.4 \ Microsoft \ Portable \ v4.5 \找不到Microsoft.Portable.CSharp.targets“ . 确认声明中的路径是否正确,以及该文件是否存在于磁盘上 . d:\ a \ 3 \ s \ portableextensibility \ portableextensibility.csproj(42,3):错误MSB4019:导入的项目“C:\ Program Files \ dotnet \ sdk \ 1.0.4 \ Microsoft \ Portable \ v4.5 \ Microsoft .Portable.CSharp.targets“找不到 . 确认声明中的路径是否正确,以及该文件是否存在于磁盘上 . C:\ Program Files \ dotnet \ sdk \ 1.0.4 \ NuGet.targets(97,5):错误:无法为'.NETCoreApp,版本解析'd:\ a \ 3 \ s \ portableextensibility \ portableextensibility.csproj' = 1.1' 版 . [d:\ a \ 3 \ s \ dotnetcompatibility.sln] C:\ Program Files \ dotnet \ sdk \ 1.0.4 \ NuGet.targets(97,5):错误:无法解析'd:\ a \ 3 \ s \ portablelibrary \ portablelibrary.csproj'for'.NETCoreApp,Version = v1.1' . [d:\ a \ 3 \ s \ dotnetcompatibility.sln]生成MSBuild文件d:\ a \ 3 \ s \ mainconsole \ _ obj \ mainconsole.csproj.nuget.g.props . 生成MSBuild文件d:\ a \ 3 \ s \ mainconsole \ _ obj \ mainconsole.csproj.nuget.g.targets . 将锁文件写入磁盘 . 路径:d:\ a \ 3 \ s \ mainconsole \ obj \ project.assets.json对于d:\ a \ 3 \ s \ mainconsole \ mainconsole.csproj,恢复在37.7秒内失败 . d:\ a \ 3 \ s \ business \ business.csproj中的错误无法为'.NETStandard,Version = v1.1'解析'd:\ a \ 3 \ s \ portablelibrary \ portablelibrary.csproj' . d:\ a \ 3 \ s \ mainconsole \ mainconsole.csproj中的错误无法为'.NETCoreApp,Version = v1.1'解析'd:\ a \ 3 \ s \ portableextensibility \ portableextensibility.csproj' . 无法为'.NETCoreApp,Version = v1.1'解析'd:\ a \ 3 \ s \ portablelibrary \ portablelibrary.csproj' .
2 回答
由于该解决方案包含当前无法使用
dotnet
cli构建的PCL库,因此必须通过msbuild
而不是基于dotnet
的命令构建项目 .以下是更正后的配置:
Build Definition
Queue options
Result