project.assets.json 的对象模型是什么?我们可以使用什么库从文件中解析它?
What is the object model for the project.assets.json and what library can we use to parse it from the file?
我不是在谈论 Newtonsoft.Json - 我想要为 project.assets.json
定制的实际对象模型
有图书馆吗?
在浏览了 dotnet/sdk repository, I eventually found a reference to the NuGet/NuGet.Client repository, which defines a LockFile
class 之后,其中包含许多与 project.assets.json
文件相同的属性。
原来这个 class 发布在 NuGet.ProjectModel 包中。还证明这个包还包括 classes 把这个文件变成一个对象模型。
将文件内容“序列化”为对象模型的示例代码:
using NuGet.ProjectModel;
class Program
{
static void Main()
{
string content = System.IO.File.ReadAllText("my-folder/project.assets.json");
var lockFileFormat = new LockFileFormat();
var lockFile = lockFileFormat.Parse(content, "In Memory");
}
}
我不是在谈论 Newtonsoft.Json - 我想要为 project.assets.json
定制的实际对象模型有图书馆吗?
在浏览了 dotnet/sdk repository, I eventually found a reference to the NuGet/NuGet.Client repository, which defines a LockFile
class 之后,其中包含许多与 project.assets.json
文件相同的属性。
原来这个 class 发布在 NuGet.ProjectModel 包中。还证明这个包还包括 classes 把这个文件变成一个对象模型。
将文件内容“序列化”为对象模型的示例代码:
using NuGet.ProjectModel;
class Program
{
static void Main()
{
string content = System.IO.File.ReadAllText("my-folder/project.assets.json");
var lockFileFormat = new LockFileFormat();
var lockFile = lockFileFormat.Parse(content, "In Memory");
}
}