I can see that some UWP projects has project.json file and all the NuGet packages entries are included in the project.json. But some UWP projects doesnt has project.json. NuGet packages entries are included in .csproj file itself. Why?
问题:
回答1:
In earlier stages of developing .NET Core tooling project.json (developed by ASP.NET Core team) was seen as a better way to manage NuGet packages, but later decision was made to move back to .csproj for various reasons. So now UWP is storing references to packages in .csproj since it's using .NET Core as well. You can read more here and here.
EDIT:
If I understand correctly, managing packages in .csproj requires Visual Studio 2017, and VS 2015 only understands project.json. That is why, by default, if you create UWP project in VS 2017 it will add project.json to be backwards compatible with VS 2015 (unless you target Creators Update which isn't supported by 2015 anyway).
However, even if you create a project without project.json in VS 2017 and lower its TargetPlatformVersion, it will still work, but only in VS 2017. So to decide to use project.json or not, you should simply decide whether you want to support VS 2015 or not.
This discussion might clear it more.