2

I have run into VS always rebuilding projects before, but turning on detailed output usually told me right away why it was rebuilding. This time I get the output below and I can't figure out what is triggering the rebuild or what "Failed to resolve all items referenced by ..." really means or what I can do about it.

Does anybody know how to interpret this build output so I can stop this project from rebuilding all the time? There is more to the output, but I just copied the first 100 lines

Build started...
Failed to resolve all items referenced by 'SkyCourt.Tests.Infrastructure\SkyCourt.Tests.Infrastructure.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'WebJobMembershipTypesDaily\WebJobMembershipTypesDaily.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.Tests.CourtBookingReports\SkyCourt.Tests.CourtBookingReports.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt\SkyCourt.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.Tests.Models\SkyCourt.Tests.Models.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.Tests.ClubService\SkyCourt.Tests.ClubService.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.UI\SkyCourt.UI.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SparkPost\SparkPost.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.App.Automapper\SkyCourt.App.Automapper.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.Tests.Api\SkyCourt.Tests.Api.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.App.ViewModels\SkyCourt.App.ViewModels.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.App.Api\SkyCourt.App.Api.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.App.Utilities\SkyCourt.App.Utilities.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.App.Models\SkyCourt.App.Models.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.Tests.InterCityLeagues\SkyCourt.Tests.InterCityLeagues.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.Tests.ClassLibraries\SkyCourt.Tests.ClassLibraries.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.Tests.Helpers.Signalr\SkyCourt.Tests.Helpers.Signalr.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.Tests.Helpers.Stripe\SkyCourt.Tests.Helpers.Stripe.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.Infrastructure\SkyCourt.Infrastructure.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.Tests.ClubTeamLeagues\SkyCourt.Tests.ClubTeamLeagues.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'Resources\CommonResources.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
Failed to resolve all items referenced by 'SkyCourt.Tests.App\SkyCourt.Tests.App.csproj'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
1>------ Build started: Project: SkyCourt.Infrastructure, Configuration: Debug Any CPU ------
1>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
1>Trying to import C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\$(MSBuildToolsVersion)\Microsoft.Common.props using extensions path C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild
1>Property reassignment: $(MSBuildProjectExtensionsPath)="C:\Users\gregv\source\repos\SquashSpider\SquashSpider\SkyCourt.Infrastructure\obj\" (previous value: "obj\") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Microsoft.Common.props (56,5)
1>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
1>Trying to import C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore\* using extensions path C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild
1>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
1>The "Configuration" property is a global property, and cannot be modified.
1>The "Platform" property is a global property, and cannot be modified.
1>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
1>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
1>The "Configuration" property is a global property, and cannot be modified.
1>The "Platform" property is a global property, and cannot be modified.
1>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
1>Property reassignment: $(DefineCommonItemSchemas)="false" (previous value: "true") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\Managed\Microsoft.Managed.DesignTime.targets (12,5)
1>Property reassignment: $(DefineCommonCapabilities)="false" (previous value: "true") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\Managed\Microsoft.Managed.DesignTime.targets (13,5)
1>Property reassignment: $(DefineCommonReferenceSchemas)="false" (previous value: "true") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\Managed\Microsoft.Managed.DesignTime.targets (14,5)
1>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
1>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
1>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
1>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
1>The "Configuration" property is a global property, and cannot be modified.
1>The "Platform" property is a global property, and cannot be modified.
1>Property reassignment: $(_DebugSymbolsProduced)="true" (previous value: "false") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets (150,5)
1>Property reassignment: $(_DocumentationFileProduced)="false" (previous value: "true") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets (159,5)
1>The "DevEnvDir" property is a global property, and cannot be modified.
1>The "SolutionName" property is a global property, and cannot be modified.
1>The "SolutionFileName" property is a global property, and cannot be modified.
1>The "SolutionPath" property is a global property, and cannot be modified.
1>The "SolutionDir" property is a global property, and cannot be modified.
1>The "SolutionExt" property is a global property, and cannot be modified.
1>Property reassignment: $(ProcessorArchitecture)="msil" (previous value: "") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets (490,5)
1>Property reassignment: $(DelaySign)="" (previous value: "false") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets (530,5)
1>Property reassignment: $(_SGenGenerateSerializationAssembliesConfig)="Auto" (previous value: "") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets (3530,5)
1>Property reassignment: $(_SGenGenerateSerializationAssembliesConfig)="Off" (previous value: "Auto") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets (3531,5)
1>Property reassignment: $(_CodeAnalysisTreatWarningsAsErrors)="false" (previous value: "") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\CodeAnalysis\Microsoft.CodeAnalysis.targets (125,5)
1>Property reassignment: $(PrepareForRunDependsOn)="
1>      CopyFilesToOutputDirectory
1>    ;RunCodeAnalysis" (previous value: "
1>      CopyFilesToOutputDirectory
1>    ") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\CodeAnalysis\Microsoft.CodeAnalysis.targets (167,9)
1>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
1>Property reassignment: $(ResolveReferencesDependsOn)="
1>      
1>      BeforeResolveReferences;
1>      AssignProjectConfiguration;
1>      ResolveProjectReferences;
1>      FindInvalidProjectReferences;
1>      ResolveNativeReferences;
1>      ResolveAssemblyReferences;
1>      GenerateBindingRedirects;
1>      ResolveComReferences;
1>      AfterResolveReferences
1>    ;
1>      ImplicitlyExpandDesignTimeFacades
1>    " (previous value: "
1>      BeforeResolveReferences;
1>      AssignProjectConfiguration;
1>      ResolveProjectReferences;
1>      FindInvalidProjectReferences;
1>      ResolveNativeReferences;
1>      ResolveAssemblyReferences;
1>      GenerateBindingRedirects;
1>      ResolveComReferences;
1>      AfterResolveReferences
1>    ") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.NETFramework.CurrentVersion.targets (75,5)
1>Property reassignment: $(PrepareResourceNamesDependsOn)="
1>                    AssignWinFXEmbeddedResource;
1>                    
1>      AssignTargetPaths;
1>      SplitResourcesByCulture;
1>      CreateManifestResourceNames;
1>      CreateCustomManifestResourceNames
1>    
1>      " (previous value: "
1>      AssignTargetPaths;
1>      SplitResourcesByCulture;
1>      CreateManifestResourceNames;
1>      CreateCustomManifestResourceNames
1>    ") at C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets (97,7)

Update

After following the advice of Perry to do an update-package -reinstall and to turn on diagnostic output (I thought I had), I can see that the real reason that the project is rebuild is this:

1>Project 'SkyCourt.Tests.Helpers.MVC' is not up to date. CopyLocal reference 'C:\Users\gregv\source\repos\SquashSpider\SquashSpider\SkyCourt.Tests.Helpers.MVC\bin\Debug\System.Security.Cryptography.Algorithms.dll' is missing from output location.

The strange thing is that System.Security.Cryptography.Algorithms is installed for this project. And on the references, the CopyLocal flag is true.

Where is this dll supposed to live on my disk and where is it supposed to be copied to?

It seems that I need this package because System.Net.Http required it and pulled it in.

Final Update

I believe this constant rebuilding started because in one of my projects, the compiler suggested that I needed to add System.Net.Http in order to satisfy the reference to HTTP context. However, that is the wrong thing to do and leads to one of these cases of DLLs not being copied to the output directory. Instead, I should have added a reference to Microsoft.AspNet.WebApi. When I did that, it solved that issue. Here is a reference to the SO answer that helped me find that.

Then a number of other projects had references to System.Data (that I could just remove from the NuGet Package Manager) and some other System.* components that were actually provided by mscor.lib or something like that. It was a very tedious process of building over and over again with Diagnostic output enabled to see which dlls were missing and then figuring out what to do with each one. The diagnostic output causes the build to be at least 5x slower.

And one last thing, if you find that these Dlls are not found during run time, it might be due to this. You need to remove any binding redirects that you might have in app.config for the dlls on the list in that GitHub issue. Those dlls are now part of .Net and don't ship as separate dlls anymore.

Greg Veres
  • 1,770
  • 19
  • 28
  • From the description, please check your project references, nuget package references and assembly references each other carefully. The issue is that one of them has lost which leads to unable find the dlls. So rebuild is always on. – Mr Qian Mar 04 '21 at 03:28
  • Also, did all your projects target to non-sdk net framework projects or new-sdk net core projects? – Mr Qian Mar 04 '21 at 06:08
  • after doing: update-package -reinstall, I am left with: "1>Project 'SkyCourt.App.Models' is not up to date. CopyLocal reference 'C:\Users\gregv\source\repos\SquashSpider\SquashSpider\SkyCourt.App.Models\bin\Debug\System.Runtime.InteropServices.RuntimeInformation.dll' is missing from output location." as the reason for the rebuilds – Greg Veres Mar 05 '21 at 14:10

2 Answers2

1

Just as my comment said:

From the description, please check your project references, nuget package references and assembly references each other carefully. The issue is that one of them has lost which leads to unable find the dlls. So rebuild is always on.

So please try the following steps:

1) enter Tools-->Options-->Nuget Package Manager-->General and then check these two options

enter image description here

2) If your projects has any non-sdk net framework projects, you have to run these command under Tools-->Nuget Package Manager-->Package Manager Console:

update-package -reinstall

3) check all projects under your solution, make sure the project references all exist, or you could delete the project reference and then re-add them.

Also, please check if you have any assembly dlls under Add Reference, please make sure they exist and use the right hintpath. Besides, make sure you did not reference any abandoned nuget package.

After that, rebuild your solution first. Then, click Build to check if it is up-to-date.

In addition, if you want to see the reason of rebuild, you could set Build Project output log to Diagnostic. Like this:

enter image description here

Final Update------due to the issue dlls

I believe this constant rebuilding started because in one of my projects, the compiler suggested that I needed to add System.Net.Http in order to satisfy the reference to HTTP context. However, that is the wrong thing to do and leads to one of these cases of DLLs not being copied to the output directory. Instead, I should have added a reference to Microsoft.AspNet.WebApi. When I did that, it solved that issue. Here is a reference to the SO answer that helped me find that.

Then a number of other projects had references to System.Data (that I could just remove from the NuGet Package Manager) and some other System.* components that were actually provided by mscor.lib or something like that. It was a very tedious process of building over and over again with Diagnostic output enabled to see which dlls were missing and then figuring out what to do with each one. The diagnostic output causes the build to be at least 5x slower.

And one last thing, if you find that these Dlls are not found during run time, it might be due to this. You need to remove any binding redirects that you might have in app.config for the dlls on the list in that GitHub issue. Those dlls are now part of .Net and don't ship as separate dlls anymore.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41
  • This is an ASP.Net MVC project (pre-.NetCore) I already had those options set. How am I supposed to "check my project references"? Am I just supposed to open the references item in each project in the Solution Explorer and look for the yellow triangle next to a reference? I did that - no yellow triangles. I have rebuilt the solution many times. And the output I posted was the diagnostic build output. I was expecting the reason to be output, but I didn't see it. – Greg Veres Mar 05 '21 at 12:59
  • I am running the update-package -reinstall. It taking a very long time, but it is a fairly big solution with 24 projects – Greg Veres Mar 05 '21 at 13:01
  • BEWARE: for any one following along at home, update-package -reinstall ca be labour intensive to recover from. If you have modified any packages (like the ASP-Help package or any javascript packages - to move the files to reasonable locations), this command undoes all of that because it removes every package and reinstalls every package. I would recommend doing this as your only change so you can use git to undo the damage it does. – Greg Veres Mar 05 '21 at 14:07
  • Even though I said I turned on diagnostic logs, I was wrong. I turned on detailed logs so I missed the output that told me what was wrong. After doing the update-package -reinstall, I went from 3 packages always rebuilding to 15 packages always rebuilding. But now I see that System.Runtime.InteropServices.RuntimeInformation.dll is missing – Greg Veres Mar 05 '21 at 14:09
  • BTW, I see that you are from MSFT. The reason why the build was kicked off shouldn't require diagnostic logs. It should be part of minimal output. Or there should be a separate option that can be enabled to output that piece of information, I need that info to solve this problem, but I am wasting a ton of time because diagnostic output slows down the build so much. – Greg Veres Mar 05 '21 at 14:27
  • Thanks for your feedback. And be glad to know that you have found the issue. And the goal of diagnostic output is to show the problem dlls. And when you find the problem dlls, you could cancel the build process. Since you found the issue and the problem is quite under the nuget, dlls, I have added your tips into my answer. And you can consider accepting the answer so that it will help other community members search and handle similar issues:) – Mr Qian Mar 08 '21 at 09:52
0

I ran into the "Failed to resolve all items referenced in .csproj" after adding a Net5 xunit test project to a solution previously containing only a Framework 4.8 project (with legacy .csproj format).

The main project uses a nuget.config that points to a .nuget directory at the solution level (via "repositoryPath" key)--which has always worked fine. Meanwhile, the Test project was using the default packages folder in my Windows profile folder.

Adding another entry in the solution's nuget.config for the Test project (via "globalPackagesFolder" key) set both projects to look in the same spot for packages, and the warning disappeared.

Not entirely sure what's going on, but it seems something was getting confused there. All good now.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <add key="repositoryPath" value=".nuget" />
    <add key="globalPackagesFolder" value=".nuget" />
  </config>
</configuration>
osoviejo
  • 481
  • 6
  • 17