Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have an ASP.NET MVC 4 app developed in VS 2012. The app consists of a main project (MyProject), a unit-test project (MyProject.Tests), an Azure deployment project (MyProject.Azure), and a couple of general-purpose library projects.

When I right-click on either the solution or the main project and select Manage NuGet Packages, I see a bunch of Microsoft updates that have apparently become available in the last month or so. If I click on the Update All button then the updates are apparently installed without any obvious problems, but when I build the solution I get this error message TWICE:

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

Ok, so I have two projects that reference MyProject: MyProject.Tests and MyProject.Azure. I can right-click MyProject.Tests, select ManageNuGet Packages, and add Microsoft.Bcl.Build. That gets rid of one of the two warnings. But VS does not give me an option to manage NuGet packages for the MyProject.Azure project.

How do I add the Microsoft.Bcl.Build package to the Azure deployment project?

EDIT:

Thanks to user swell, I now know that a Microsoft Connect issue for this problem has been opened here.

like image 342
Bob.at.Indigo.Health Avatar asked Jun 18 '13 22:06

Bob.at.Indigo.Health


People also ask

What is Microsoft BCL build for?

This package provides build infrastructure components so that projects referencing specific Microsoft packages can successfully build.


2 Answers

The answer provided by TheESJ is correct, however the wording wasn't clear to me. Since I cannot comment on the answer, I will provide more details here. Specifically, I was having this problem with an Azure project and the following workaround was required to make the warning go away:

When you double-click the warning in VisualStudio, you will be taken to the BclBuildValidateNugetPackageReferences target in the Microsoft.BclBuild.targets file. Above the actual target element, you should find a large comment block that talks about disabling the project reference checks. Since Azure projects cannot have any library references, it is impossible for those Azure projects to fulfill the requirements of this particular build target.

The solution? Disable reference checking from the Azure project since it is impossible to actually add a nuget package reference.

EXAMPLE

So, assume we have two projects: MyAzureProject.ccproj which references MyProject.csproj. Follow these steps:

  1. Right-click on "MyAzureProject" in the Solution Explorer and select "Edit Project File."
  2. Find the project reference to "MyProject." It should look something like:

    <ProjectReference Include="..\MyProject\MyProject.csproj">   <Name>MyProject</Name>   <Project>{1d99490e-d140-4897-9890-238e673a5864}</Project>   ... </ProjectReference> 
  3. Add the following element inside of the ProjectReference element:

      <Properties>SkipValidatePackageReferences=true</Properties> 
  4. Your project reference should now look like this:

    <ProjectReference Include="..\MyProject\MyProject.csproj">   <Name>MyProject</Name>   <Project>{1d99490e-d140-4897-9890-238e673a5864}</Project>   ...   <Properties>SkipValidatePackageReferences=true</Properties> </ProjectReference> 
  5. Right-click on "MyAzureProject" in Solution Explorer and choose "Reload Project."

You should now be able to rebuild and the error should be gone.

like image 90
AggieEric Avatar answered Sep 21 '22 02:09

AggieEric


If you double click the warning it gives you instructions for disabling the warning.

It is safe to disable for projectreferences from projects that don't yet support Nuget.

See below portion in bold copied from Microsoft.Bcl.Build.targets.

BclBuildValidateNugetPackageReferences

This target can be disabled for a project reference by setting SkipValidatePackageReferences=true for the reference:

<ProjectReference Include="..\pcl\pcl.csproj">   <Project>{664a9e98-fac7-4567-a046-0dde95fddb48}</Project>   <Name>pcl</Name>   <Properties>SkipValidatePackageReferences=true</Properties> </ProjectReference> 
like image 28
TheESJ Avatar answered Sep 20 '22 02:09

TheESJ