0

我必须遵循 YamlDotNet 文档中的代码https://dotnetfiddle.net/QlqGDV

using System.Collections.Generic;
using System.IO;
using System;
using YamlDotNet.Serialization;

public class ALogger {
    public function writeFile() {
        using (var sw = new StreamWriter(_logFileCasesPath + @"\" + _logCaseName))
        {
            var ser = new Serializer();
            ser.Serialize(sw, _logCase);
        }
    }
}

但是新的序列化器抛出了这个异常,我不知道为什么。我没有找到有关该异常消息的任何提示。

Ein Ausnahmefehler des Typs "System.MissingMethodException" ist in InnoTest.exe aufgetreten.

Zusätzliche Informationen: Methode nicht gefunden: "Void YamlDotNet.Serialization.Serializer..ctor(YamlDotNet.Serialization.SerializationOptions, YamlDotNet.Serialization.INamingConvention, YamlDotNet.Serialization.YamlAttributeOverrides)".
4

1 回答 1

0

另一个使用的框架已经在 3.8 版本中包含 YamlDotNet,但我使用的是 3.9,所以存在冲突,但编译器没有找到。只有在运行时才有例外。

Cleanupedit:我设法将两个库都设置为相同的版本,而不是正常工作。然后,我与 nuget 包的开发人员交谈,让他们使用 nuget 功能进行正确的依赖管理。

于 2016-08-19T09:46:30.543 回答