x-term
x-term

Reputation: 107

Azure Devops build fails Warning MSB3245: Could not resolve this reference

I'm trying to create a pipeline in Azure DevOps and I get compilation errors caused by a missing reference:

[warning]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "ABC". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

I have a VS2017 solution with 2 projects.

  1. ABC which is the actual application

  2. ABC.UnitTests where I added some unit tests (I'm using MSTest)

When I build the solution locally, I'm able to do a successful build with the following steps:

  1. Build ABC project => ABC.dll is generated

  2. Add reference in ABC.UnitTests proj to ABC.dll

  3. Build the entire solution => build successful

The .cs file in ABC.UnitTests references the application in this way, and generates the warning above:

using ABC; 

If I do a clean build where ABC.dll is deleted and then I do a build of the entire solution I get the same MSB3245 warning. So the issue is reproducible locally if the dll does not exist.

Then, when I upload the solution to Azure DevOps, I do the following steps.

  1. Upload the solution from local VS2017 and a project is created in Azure
  2. Build the project in Azure DevOps => reference issue reported

I have a YAML config file with name azure-pipelines.yml which references the hosted 2017 agent.

pool: vmImage: 'vs2017-win2016' 

Alternate flow:

  1. Upload the solution from local VS2017 and a project is created in Azure
  2. Comment out the reference to ABC.UnitTests project from the sln file
  3. Create the pipeline => build successful.

Upvotes: 1

Views: 5294

Answers (1)

Jayendran
Jayendran

Reputation: 10910

You shouldn't refer any DLL as you mentioned in the comment.

The proper way is to refer to as a project. This way the DLL takes care of itself during the build

Proper way is References -> (Right Click) Add References -> From that using Projects tab you can choose the Project which is generating that DLL(assemblies)

You can refer this SO

Upvotes: 2

Related Questions