Good day,
Task
Setup an Azure DevOps Pipeline for an ASP .NET Core 3.1 API project.
Context
- Both projects and the solution are located in GitHub not Azure DevOps Git. Each of the projects is in a separate repository. Could that be the problem?
- Pipeline created with Visual Studio 2019 while creating a deployment profile for the project to publish to Azure App Service.
- The API project depends on a separate project containing only a class with business logic. Both of these projects started out in the same solution.
- I can compile the solution locally with zero errors.
Problem
The pipeline step that builds the project is failing due to the business logic DLL not being found. All prior steps are succeeding. This is a default pipeline created through setting up an Azure App Service publish profile for the project in Visual Studio 2019.
What I've Tried
- First, I've double checked that my project dependency references are correct. The API project depends on the DLL and the project build order is correct. The DLL project has no dependencies.
- After trying the pipeline with both projects under one solution, I quickly removed the DLL project from the solution, leaving only the API project. I then tried various means to include the DLL in the API project using an assembly dependency and by manually browsing and selecting the DLL adding a project reference.
- I've tried adding an MS Build step in the API project file that copies out the DLL to the output directory. I've also selected the DLL and enabled the Copy Local property.
With the DLL project in and not in the solution the DLL is reporting as not found during the build step in the pipeline's log.
Logs
reference:C:\hostedtoolcache\windows\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\System.Xml.XPath.XDocument.dll /reference:C:\hostedtoolcache\windows\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\WindowsBase.dll /debug+ /debug:portable /filealign:512 /optimize+ /out:obj\Release\netcoreapp3.1\ts3mpeccn.API.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /target:exe /warnaserror- /utf8output /deterministic+ /langversion:8.0 /analyzer:C:\hostedtoolcache\windows\dotnet\sdk\3.1.403\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Analyzers.dll /analyzer:C:\hostedtoolcache\windows\dotnet\sdk\3.1.403\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll /analyzer:C:\hostedtoolcache\windows\dotnet\sdk\3.1.403\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Components.Analyzers.dll Controllers\Name.cs Dto\NameDto.cs Program.cs Startup.cs "obj\Release\netcoreapp3.1\.NETCoreApp,Version=v3.1.AssemblyAttributes.cs" obj\Release\netcoreapp3.1\ts3mpeccn.API.AssemblyInfo.cs /warnaserror+:NU1605
2020-10-19T04:42:17.9436652Z Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn
2020-10-19T04:42:21.0045432Z ##[error]src\ts3mpeccn.API\Controllers\Name.cs(6,7): Error CS0246: The type or namespace name 'redexpanse' could not be found (are you missing a using directive or an assembly reference?)
2020-10-19T04:42:21.0067383Z 2>Controllers\Name.cs(6,7): error CS0246: The type or namespace name 'redexpanse' could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj]
2020-10-19T04:42:21.0076796Z ##[error]src\ts3mpeccn.API\Controllers\Name.cs(15,26): Error CS0246: The type or namespace name 'GivenFemaleName' could not be found (are you missing a using directive or an assembly reference?)
2020-10-19T04:42:21.0081303Z 2>Controllers\Name.cs(15,26): error CS0246: The type or namespace name 'GivenFemaleName' could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj]
2020-10-19T04:42:21.0087384Z ##[error]src\ts3mpeccn.API\Controllers\Name.cs(17,26): Error CS0246: The type or namespace name 'MiddleFemaleName' could not be found (are you missing a using directive or an assembly reference?)
2020-10-19T04:42:21.0090430Z 2>Controllers\Name.cs(17,26): error CS0246: The type or namespace name 'MiddleFemaleName' could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj]
2020-10-19T04:42:21.0097898Z ##[error]src\ts3mpeccn.API\Controllers\Name.cs(18,26): Error CS0246: The type or namespace name 'Surname' could not be found (are you missing a using directive or an assembly reference?)
2020-10-19T04:42:21.0103126Z 2>Controllers\Name.cs(18,26): error CS0246: The type or namespace name 'Surname' could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj]
2020-10-19T04:42:21.0245483Z 2>Done Building Project "D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj" (default targets) -- FAILED.
2020-10-19T04:42:21.0341165Z 1>Done Building Project "D:\a\1\s\ts3mpeccn.API.sln" (default targets) -- FAILED.
2020-10-19T04:42:21.0377210Z
2020-10-19T04:42:21.0378012Z Build FAILED.
2020-10-19T04:42:21.0564873Z
2020-10-19T04:42:21.0587067Z "D:\a\1\s\ts3mpeccn.API.sln" (default target) (1) ->
2020-10-19T04:42:21.0587820Z "D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj" (default target) (2) ->
2020-10-19T04:42:21.0588378Z (ResolveAssemblyReferences target) ->
2020-10-19T04:42:21.0589398Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2084,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "grimlock". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj]
2020-10-19T04:42:21.0591411Z
2020-10-19T04:42:21.0591610Z
2020-10-19T04:42:21.0591831Z "D:\a\1\s\ts3mpeccn.API.sln" (default target) (1) ->
2020-10-19T04:42:21.0592162Z "D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj" (default target) (2) ->
2020-10-19T04:42:21.0592467Z (CoreCompile target) ->
2020-10-19T04:42:21.0592970Z Controllers\Name.cs(6,7): error CS0246: The type or namespace name 'redexpanse' could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj]
2020-10-19T04:42:21.0593789Z Controllers\Name.cs(15,26): error CS0246: The type or namespace name 'GivenFemaleName' could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj]
2020-10-19T04:42:21.0594630Z Controllers\Name.cs(17,26): error CS0246: The type or namespace name 'MiddleFemaleName' could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj]
2020-10-19T04:42:21.0595608Z Controllers\Name.cs(18,26): error CS0246: The type or namespace name 'Surname' could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\src\ts3mpeccn.API\ts3mpeccn.API.csproj]
2020-10-19T04:42:21.0596153Z
2020-10-19T04:42:21.0596354Z 1 Warning(s)
2020-10-19T04:42:21.0596505Z 4 Error(s)
2020-10-19T04:42:21.0596613Z
2020-10-19T04:42:21.0596781Z Time Elapsed 00:00:05.70
2020-10-19T04:42:21.2457357Z ##[error]Process 'msbuild.exe' exited with code '1'.
2020-10-19T04:42:21.3396283Z ##[section]Finishing: Build solution ts3mpeccn.API.sln
This log is taken from the last pipeline run on Azure DevOps.
What else can I provide to help figure this out?
Thank you in advance for your suggestions.
Note: Just found this link: Add reference to Common project Azure DevOps Build Pipeline. Am testing and have updated my question.
Jason
[email protected]