This document is for common build errors and how to resolve them.
warning BUILD001: Reference to '…' was removed since the last stable release of this package. …
This warning indicates a breaking change might have been made to a package or assembly due to the removal of a reference which was used in a previous release of this assembly. See ReferenceResolution for how to suppress.
error BUILD002: Package references changed since the last release…
Similar to BUILD001, but this error is not suppressible. This error only appears in servicing builds, which should not change references between assemblies or packages.
error BUILD003: Multiple project files named 'Banana.csproj' exist. Project files should have a unique name to avoid conflicts in build output.
This repo uses a common output directory (artifacts/bin/$(ProjectName) and artifacts/obj/$(ProjectName)). To avoid conflicts in build output, each project file should have a unique name.
Opening solution filters and building may produce an error code CS0006 with a message such as
Error CS0006 Metadata file '…\AspNetCore\artifacts\bin\Microsoft.AspNetCore.Metadata\Debug\netstandard2.0\Microsoft.AspNetCore.Metadata.dll' could not be found
The cause of this problem is that the solution filter you are using does not include the project that produces this .dll. This most often occurs after we have added new projects to the repo, but failed to update our .sln/slnf files to include the new project. In some cases, it is sometimes the intended behavior of the .slnf which has been crafted to only include a subset of projects.
- Build the project on command line. In most cases, running
build.cmd
on command line solves this problem. - If the project is missing from the .sln file entirely, you can use
dotnet sln add
to add it, or else right click on the solution/folder in Visual Studio and choose Add->Existing Project, and adding it. - If it is present in the .sln, but not the .slnf, you can update the solution filter to include the missing project. You can either do this one by right-clicking on project in Visual Studio and choosing to load it's direct dependencies, and then saving. Alternatively, you can hand edit the .slnf file - it's a fairly simple json format.
Error MSB4019: The imported project "…\artifacts\bin\GenerateFiles\Directory.Build.props" was not found
You have likely attempted to use dotnet
to build a project in the repo without first generating the required files.
Prior to building without .\build.cmd
or ./build.sh
at least the following must be executed:
.\build.cmd -noBuildNative -noBuildManaged
or
./build.sh --no-build-managed
Executing .\restore.cmd
or .\build.cmd
may produce these errors:
error : Unable to locate the .NET Core SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version. error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.
In most cases, this is because the option Use previews of the .NET Core SDK in VS2019 is not checked. Start Visual Studio, go to Tools > Options and check Use previews of the .NET Core SDK under Environment > Preview Features.
The ASP.NET Core Module (ANCM) for IIS is not supported when running projects in this repository.
After using startvs.cmd
to open a solution in Visual Studio, the Kestrel web host option must be used (name of the project) and not IIS Express.
Example of running the MvcSandbox
project:
.\startvs.cmd .\src\Mvc\Mvc.sln
When attempting to restore servicing tags e.g. v3.1.7
, the NuGet.config file may contain internal feeds that are not accessible. This will result in errors such as
…\aspnetcore.dotnet\sdk\3.1.103\NuGet.targets(123,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/dnceng/_packaging/darc-int-dotnet-extensions-784b0ffa/nuget/v3/index.json. […\Temp\1gsd3rdo.srb\restore.csproj] [….nuget\packages\microsoft.dotnet.arcade.sdk\1.0.0-beta.20213.4\tools\Tools.proj]
The darc-int-...
feeds in NuGet.config are used only when building internally and are not needed after the tags are created. Delete all such entries in the file and retry.
You have likely attempted to build projects or execute tests which require the just-build Microsoft.AspNetCore.App
shared framework. Execute the following to ensure that exists within the $(DOTNET_ROOT)
folder:
.\build.cmd -projects src\Framework\App.Runtime\src\Microsoft.AspNetCore.App.Runtime.csproj
or
./build.sh --projects "$PWD/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj"