Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Error for UWP app Microsoft.Bcl.Build and packages.config next to the project file

I am getting a strange build error when building Windows Universal apps.

Severity Code Description Project File Line Suppression State Error Could not locate C:\Users\me\Source\Repos\TT\Windows\MyCommonLibrary\packages.config. Ensure that this project has Microsoft.Bcl.Build installed and packages.config is located next to the project file. MyApp

'MyApp' has a project reference to 'MyCommonLibrary'.

What is really weird is that even though it is displayed as a build 'error'. This does not effect my ability to build 'MyApp' or 'MyCommonLibrary'!

It also does not prevent me from deploying and running my app locally or otherwise. It is just a annoying to see this listed as a build error when it doesn't break the build!

like image 785
emseetea Avatar asked Feb 18 '16 16:02

emseetea


2 Answers

I followed up with the Bcl.Build package owners and got a response from Eric St. John. He says that you shouldn't reference Bcl.Build in your UWP project that uses project.json, and there's a project property to suppress the warning that is telling you to do so.

Correct, the problem is most of the packages out there that use it also don’t know about UWP either and if they update for UWP we want them to drop this dependency rather than make it work. The package isn’t needed at all for UWP or any framework that supports project.json.

To work around the error with the old package do the following:

Add <SkipValidatePackageReferences>true</SkipValidatePackageReferences> to the at the top of your csproj/vbproj

like image 172
RandomEngy Avatar answered Oct 24 '22 02:10

RandomEngy


I believe this is a false positive from the Nuget Update to 3.1.

For the time I solved it by creating the packages.config Visual Studio demands manually out of the existing project.json.

For instance:

project.json

{
  "dependencies": {
    "Microsoft.Bcl.Build": "1.0.21",
    "Newtonsoft.Json": "8.0.2"
  },
  "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}

packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="uap10.0" />
  <package id="Newtonsoft.Json" version="8.0.2" targetFramework="uap10.0" />
</packages>
like image 4
Amenti Avatar answered Oct 24 '22 01:10

Amenti