I have a simple .NET Core 2.2 website along with Microsoft.Identity.Web added as a .NET Core assembly. The following .csproj files make up my solution:

Main project:

<Project Sdk="Microsoft.NET.Sdk.Web">

 <PropertyGroup>
  <TargetFramework>netcoreapp2.2</TargetFramework>
  <WebProject_DirectoryAccessLevelKey>1</WebProject_DirectoryAccessLevelKey>
  <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
  <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
 </PropertyGroup>


 <ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore.App" />
  <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
  <PackageReference Include="Microsoft.Graph" Version="1.14.0" />
  <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.7.2" />
  <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
  <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
  <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
 </ItemGroup>

 <ItemGroup>
  <ProjectReference Include="..\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj" />
 </ItemGroup>


 <ItemGroup>
   <WCFMetadata Include="Connected Services" />
 </ItemGroup>

</Project>

Microsoft.Identity.Web project:

<Project Sdk="Microsoft.NET.Sdk">

 <PropertyGroup>
   <TargetFramework>netcoreapp2.2</TargetFramework>
 </PropertyGroup>

 <ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore.App" />
  <PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="2.2.0" />
  <PackageReference Include="Microsoft.Identity.Client" Version="3.0.6-preview" />
 </ItemGroup>
</Project>

NOTE: I can build the solution locally without issue and have never had an issue with it building or running -ever.

I created a new Azure DevOps pipeline and pointed it at my Github repo. During the NuGetCommand process it fails telling me:

[error]The nuget command failed with exit code(1) and error(NU1607: Version conflict detected for Microsoft.AspNetCore.Antiforgery. Reference the package directly from the project to resolve this issue.

Based on this I thought I needed to install that package directly so I went to NuGet package manager, searched for the package, and installed it. Then I get a different error:

[error]The nuget command failed with exit code(1) and error(NU1607: Version conflict detected for Microsoft.AspNetCore.Authentication.Cookies. Reference the package directly from the project to resolve this issue.

Tried installing that package and I get another error:

[error]The nuget command failed with exit code(1) and error(NU1607: Version conflict detected for Microsoft.AspNetCore.Authorization.Policy. Reference the package directly from the project to resolve this issue.

..and so on and so on...

So installing these erroneous packages is not likely the right way forward so I also tried:

  1. Changing my main .csproj file to use <PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" /> but that just gave more of the same above errors (different ones) and according to Nate here we shouldn't be including explicit versions.

  2. At one point after installing all these packages it seemed to be hung on the <PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="2.2.0" /> reference so following guidance from a colleague I changed that version to 2.1.0 but again, no resolution; just more red herrings.

I've been fighting with this for four days now and I'm completely lost on how to solve it. Any guidance would be appreciated.

Update:

Initially I had set up my DevOps build pipeline by following the 'wizard' steps within DevOps itself. I chose my repo and it selected my master branch automatically including setting up a yaml file. I ran the build as the last step in the wizard and that's where my problems started.

I thought I would take a different approach in troubleshooting by setting up my Azure resource group first, then my app service, dependent PaaS services, and finally configure the 'deployment options' section. I followed the steps there to choose Azure DevOps as my build/deploy pipeline, selected my organization, repo, and clicked finish. It set up the build and deploy without issue.

I'll leave this post here for suggestions and hopefully have a definitive answer to why it didn't work. I feel like the errors with my first approach were red herrings all together though...

0 Answers