I keep getting dependencies errors in my .net core2.1.1 MVC website. It builds fine from my PC. but Azure DevOps is not compiling refrences properly.
Adding a couple of pics to help sort this out.
DevOps Error. After I added a update nuget to the latest
The nuget command failed with exit code(1) and error(NU1607: Version conflict detected for Microsoft.Extensions.DependencyInjection.Abstractions. Reference the package directly from the project to resolve this issue. CBW.Website (>= 1.0.0) -> Microsoft.VisualStudio.Web.CodeGeneration.Design (>= 2.1.5) -> Microsoft.VisualStudio.Web.CodeGenerators.Mvc (>= 2.1.5) -> Microsoft.VisualStudio.Web.CodeGeneration (>= 2.1.5) -> Microsoft.Extensions.DependencyInjection (>= 2.1.1) -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.1) CBW.Website (>= 1.0.0) -> Microsoft.AspNetCore.App (>= 2.1.0) -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.0). Errors in D:\a\1\s\CBW.Website\CBW.Website.csproj NU1607: Version conflict detected for Microsoft.Extensions.DependencyInjection.Abstractions. Reference the package directly from the project to resolve this issue. CBW.Website (>= 1.0.0) -> Microsoft.VisualStudio.Web.CodeGeneration.Design (>= 2.1.5) -> Microsoft.VisualStudio.Web.CodeGenerators.Mvc (>= 2.1.5) -> Microsoft.VisualStudio.Web.CodeGeneration (>= 2.1.5) -> Microsoft.Extensions.DependencyInjection (>= 2.1.1) -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.1) CBW.Website (>= 1.0.0) -> Microsoft.AspNetCore.App (>= 2.1.0) -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.0).)
Packages failed to restore
***************Edit I passed the nuget errors based on and targeting the everything to version 2.1.5 in my csproj. Now I am back to the restore error.
My Csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RuntimeFrameworkVersion>2.1.5</RuntimeFrameworkVersion>
<UserSecretsId>aspnet-AspNetCorePagesIdentity-***************-***-*******-</UserSecretsId>
<TypeScriptToolsVersion>3.0</TypeScriptToolsVersion>
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Content Include="Client\assets\controlbyweb-logo.png" />
<Content Include="Client\assets\webrelay_170.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.5" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.5" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Folder Include="Areas\Identity\Services\" />
</ItemGroup>
<ItemGroup>
<Content Update="Client\_ViewImports.cshtml">
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
</ItemGroup>
</Project>
**** error**
2018-10-08T14:44:09.2159846Z Restoring packages for D:\a\1\s\CBW.Website\CBW.Website.csproj...
2018-10-08T14:44:09.7085782Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error : Package Microsoft.VisualStudio.Web.CodeGeneration.Design 2.1.5 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.VisualStudio.Web.CodeGeneration.Design 2.1.5 supports: [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7094563Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error : - net461 (.NETFramework,Version=v4.6.1) [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7099570Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error : - netstandard2.0 (.NETStandard,Version=v2.0) [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7102618Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error : Package Microsoft.AspNet.WebApi.Client 5.2.6 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.AspNet.WebApi.Client 5.2.6 supports: [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7103331Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error : - net45 (.NETFramework,Version=v4.5) [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7103534Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error : - netstandard2.0 (.NETStandard,Version=v2.0) [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7103694Z Package Microsoft.Extensions.WebEncoders 2.1.1 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.Extensions.WebEncoders 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
2018-10-08T14:44:10.0475303Z Package Microsoft.Net.Http.Headers 2.1.1 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.Net.Http.Headers 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
2018-10-08T14:44:10.0475426Z Package Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.5 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.5 supports: netstandard2.0 (.NETStandard,Version=v2.0)
2018-10-08T14:44:10.0475562Z One or more packages are incompatible with .NETCoreApp,Version=v2.1.
2018-10-08T14:44:10.0475666Z
2018-10-08T14:44:10.0475771Z NuGet Config files used:
2018-10-08T14:44:10.0475909Z D:\a\1\Nuget\tempNuGet_13.config
2018-10-08T14:44:10.0476013Z
2018-10-08T14:44:10.0476113Z Feeds used:
2018-10-08T14:44:10.0476241Z https://api.nuget.org/v3/index.json
2018-10-08T14:44:10.1010270Z ##[error]Error: C:\hostedtoolcache\windows\dncs\1.0.4\x64\dotnet.exe failed with return code: 1
2018-10-08T14:44:10.1032411Z ##[error]Packages failed to restore
2018-10-08T14:44:10.1055895Z ##[section]Finishing: Restore