0

We recently upgraded our solution from Framework 4.5.1 to 4.6.2. It all worked and compiled fine, until we checked out an older branch targeting to Framework 4.5.1.

We started getting number of errors suggesting

All projects referencing MyProject.csproj must install nuget package Microsoft.Bcl.Build

Due to this compilation gets failing. The same branch is compiling without any errors on the systems where the branch having newer .NET framework is never checked out.

One of the project in that solution has reference of Microsoft.Bcl.Build Nuget package, so just to verify how this behaves on older git branches, I also tried taking a very old branch which is not having "Microsoft.Bcl.Build" reference, and started getting error

The type or namespace name 'XXX' does not exist in the namespace 'MyProject'

Eventhough I can see the DLLs are getting created, the compilation is failing with above error.

This is the same issue in all machines where branch with .NET Fx 4.6 was checked out for atleast once. Even the older branches are not compiling which were previously compiling and publishing without any issues, and are unchanged since than.

I believe this has something to do with Microsoft.Bcl.Build. Though that package is not referenced in older branches, it might had done something at system level which seems to be inferring with MsBuild.

Would like to know if anyone has any idea about this?

Also, I would be happy to provide more information:

Till now, I have already tried -

  1. Uninstalling .NET Framework 4.6.2
  2. Restarted the machine
  3. Cleaned Temp folder, as well as Temporary ASP.NET Websites folder
  4. Cleared Packages folder, and restored Nuget packages for the solution

But nothing has worked so far.

* UPDATE 1 *

MyProject.csproj file contains following line:

<Import Project="..\..\ZerochaosWeb\ZCW\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\ZerochaosWeb\ZCW\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />

Does it have to do anything with the issue I am facing?

Nirman
  • 6,715
  • 19
  • 72
  • 139
  • Do you have a `packages.config` file, if so add it to your question. If you have a newer style project that puts the packages in the csproj file instead of the packages.config file include all of the `PackageReference` lines from your .csproj file in your question – Scott Chamberlain Mar 15 '18 at 20:11
  • Go back to your old environment to identify all the things related to `Microsoft.Bcl`, `Microsoft.Bcl.Async` and `Microsoft.Bcl.Build`. Then remove them from your csproj files, and/or NuGet package list. In your case, it is very likely that you forgot to delete the targets include statements `Microsoft.Bcl.Build` inserted. Such are obsolete and you should never need them again. – Lex Li Mar 15 '18 at 22:15
  • @ScottChamberlain, Lex Li - There is no "PackageReference" section in the csproj file, however, I can see an Import element referring to Microsoft.Bcl.Build package. I have updated the same in the original question. Could you please suggest whether this should be removed? – Nirman Mar 19 '18 at 09:35

0 Answers0