Hoardling
Hoardling

Reputation: 103

Azure-DevOps clone shows references as warnings

Cloning a project and it looks like it comes down fine, until I look in the references and they all have the yellow warning triangle. Then my Error List shows all the references as Warnings. My application is on Visual Studio 2017 and it is MVC with C# coding using .NET Framework 4.7.2. In my normal application, original, the references are perfectly fine and no errors and it works great. Builds and works fine. Once I bring down the clone is then the references are lost. I've done a build on the cloned version and it shows all the references as warnings.

I've double clicked a reference and received an error popup box of "This project cannot be viewed in the object browser because it is unavailable or not yet built. Please ensure that the project is available and built". It feels like Azuredev-ops is just missing my references and their location. I am the only one working on this, so there should be no conflicts. I've posted and cloned right after posting, with same result. My code and Web configs look just fine. I have cloned on other people's system too, and same problem with this application. FYI, many of my other applications are working fine using the clone. Just 1 application is having issues. My references are separated in that some are Copy Local True while others are False. I've also removed a reference and added it back, and it comes back with a warning as if it were never added.

Warning message for individual reference: The referenced component 'EntityFramework' could not be found.

I am also seeing errors for NuGet packages not being there, but when I look I see the package folder with all it's components in it.

It says that for all my windows core references. And just warning symbols in my reference folder for other references.

I am expecting no errors when I bring down the clone. I've upload using my machine and cloning should be able to use the same reference locations. It just feels like AzureDev-Ops is stripping my reference links out, and then going I can't find them.

Upvotes: 1

Views: 1127

Answers (3)

dicksonlim0226
dicksonlim0226

Reputation: 1

This is my solution to solved this problem:

  1. In the Solution Explorer, unload the Problematic Project
  2. Right-click on the same project > Edit Project File
  3. Replace all ..\packages to $(SolutionDir)packages > Save
  4. Reload project > Restore NuGet Packages > Rebuild Solution

Example:

<Import Project="..\packages\Microsoft.AspNet.Mvc.5.2.7\build\net45\Microsoft.AspNet.Mvc.targets" />
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\Microsoft.AspNet.Mvc.dll</HintPath>

Replace to

<Import Project="$(SolutionDir)packages\Microsoft.AspNet.Mvc.5.2.7\build\net45\Microsoft.AspNet.Mvc.targets" />
<HintPath>$(SolutionDir)packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\Microsoft.AspNet.Mvc.dll</HintPath>

Upvotes: 0

Hoardling
Hoardling

Reputation: 103

I figured it out. I went to my original and did the Update-Package -reinstall. It came back with the Microsoft.CodeDom.Providers.DotNetCompiler.Platform.2.0.0 not there, but it added one, just not 2.0.0. Then I ran an uninstall of the Microsoft.CodeDom.Providers.DotNetCompiler removing it from my system. Then I posted my original up to AzureDev-ops. My clone came down, not all the references were messed up, some were still, but I did a rebuild and that cleared it up. Thank you to the responses, it pointed me in the right direction.

Upvotes: 0

Leo Liu
Leo Liu

Reputation: 76918

Azure-DevOps clone shows references as warnings

To resolve this issue, you should make sure of the following:

  • Make sure you have checked those two options Allow NuGet to download missing packages and Automatically check for missing packages during build in Visual Studio:

    enter image description here

  • Make sure you do not check the \packages folder to the source control.

  • When you clone the project from Azure-DevOps server and get missing reference error, you should use the NuGet command line Update-Package -reinstall in the Package Manager Console to force reinstall the package references into project. Check this thread for some more info.

Note: Especially need to pay attention to the third point.

Update:

Error:Mircrosoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0

According to the error message, it seems you are not add your packages to your packages source in Visual Studio.

You should publish your custom packages to the nuget feed or you can create you local nuget feed, then add the nuget feed path or local feed path to the package source:

Check this document for some more details.

Hope this helps.

Upvotes: 2

Related Questions