Forum Visual Studio

NuGet v3 with project.json

OrenNovotnyOrenNovotny USMember, Insider, Beta, University ✭✭

Hi all,

I was just looking to see what the plans are for supporting NuGet v3 and project.json in XS? project.json can be used instead of packages.config for any project type and it works great in VS.

Among it's main advantages are:
- references are not stored in csproj file. Decreases merging pain when updating references
- transitive refs mean not having to list every package in the chain. This has tremendous improvements for Xamarin.Forms projects, especially on Android, where large numbers of packages are pulled in.

Best Answers


  • OrenNovotnyOrenNovotny USMember, Insider, Beta, University ✭✭

    I suppose one thing that can help, as an interim step, is to get the Xamarin Forms NuGet packages to support the v3 /contentFiles metadata so that the appropriate content is pulled in correctly. This can be tested today with VS and would prepare it for eventual XS support.

  • MichaelTeper.9743MichaelTeper.9743 USMember
    edited February 2016

    Is there a Bugzilla case that tracks this?


  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    I use VS2015 Enterprise Update 2. My XF solution has 14 projects. One of those has been created with VS2015 and uses project.json. All others are older and have been created either with XS or VS2013. They still use packages.config.

    I always get this warning:

    D:\RoyalFamily\RoyalShared\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets(225,5): warning : All projects referencing RoyalDocument.PCL.csproj must install nuget package Microsoft.Bcl.Build. For more information, see

    (No idea why this loads the file from Microsoft.Bcl.Build.1.0.14. All my projects reference 1.0.21.)

    Today I decided that I don't want to ignore this warning anymore and installed Microsoft.Bcl.Build in the new project. All others already referenced it. But now I get this error:

    C:\Users\Michael.nuget\packages\Microsoft.Bcl.Build\1.0.21\build\Microsoft.Bcl.Build.targets(243,5): error : Could not locate D:\RoyalFamily\RoyalShared\RoyalPasswords\RoyalPasswords.BrowserExtensions.PCL\packages.config. Ensure that this project has Microsoft.Bcl.Build installed and packages.config is located next to the project file.

    So I had to remove the Microsoft.Bcl.Build package again. The error is gone, the warning is back.

    Any idea how I could resolve this @OrenNovotny @mattward ?

  • mattwardmattward GBMember Xamurai

    @MichaelRumpler - I am not an expert on how the Bcl.Build NuGet package works. The first warning looks like one of your projects still has a reference to the 1.0.14 Bcl.Build.targets file in its project file. The error looks like Bcl.Build only works with projects that use a packages.config file. I am assuming that error is from a project that uses a project.json file.

    So I can only suggest looking at using one of the properties to disable this warning if you believe it is incorrect. This will only work on Windows though. From the 1.0.21 Bcl.Build.targets file:

    This target validates that any Nuget packages installed in the current project are also installed in projects 
    referencing the current project.
    This is necessary because Nuget packages contain more than just simple references.  Installing the package ensures
        1. The right set of references for the target framework are added
        2. Config file transforms are applied
        3. Project installation scripts are run
    For all packages listed as installed for the current project in packages config, if the package ID matches one
    specified in @(ValidatePackages), ensure that the same package is installed in the referencing project. 
    This target can be disabled for a project reference by setting SkipValidatePackageReferences=true for the reference:
    <ProjectReference Include="..\pcl\pcl.csproj">
    This target can be disabled for all references to a project by adding the following:
Sign In or Register to comment.