【问题标题】:Refit Update package on Xamarin在 Xamarin 上改装更新包
【发布时间】:2015-10-27 09:53:08
【问题描述】:

我刚刚使用 refit 包 (2.3.0. -> 2.4.1) 更新了 Xamarin 解决方案,现在构建抱怨:

RefitStubs.g.cs(37,27): error CS0102: The type `Sample.App.Api' already contains a definition for `Client'
    RefitStubs.cs(37,27): (Location of the symbol related to previous error)

我已尝试还原软件包版本,但出现同样的错误。我已经清理了解决方案,但仍然是同样的问题

【问题讨论】:

    标签: ios xcode xamarin refit


    【解决方案1】:

    我在*.g.cs 生成的文件中遇到了相关问题...我不知道为什么有时在(重新)构建全部期间文件没有被覆盖,但在我见过的其他项目中,请确保您确实没有在您的项目 (.csproj) 中引用了生成的文件本身,这有时会在您调试到 *.g.cs 文件时发生。

    此外,Clean All 不会从 obj 目录中删除 Refit 构建任务生成的文件 RefitStubs.g.cs(或 RefitParams.rsp)。

    尝试删除 obj 目录并再次执行 (Re)Build All 以查看是否有帮助。

    在(重新)构建所有之后:

    obj/ > ls -1
    RefitParams.rsp
    RefitStubs.g.cs
    refit-test.csproj.FilesWrittenAbsolute.txt
    refit-test.exe
    refit-test.exe.mdb
    

    全部清除后:

    obj/ > la -1
    RefitParams.rsp
    RefitStubs.g.cs
    

    【讨论】:

      【解决方案2】:

      查看您的项目根目录中是否有 refitStubs.cs 文件并将其删除。为我工作;)

      【讨论】:

        【解决方案3】:

        按照之前的 Refit 版本排序

        【讨论】:

          【解决方案4】:

          就像@cristianomad 所说,发生这种情况是因为 Refit 从使用公开的 RefitStubs.cs 转移到 - RefitStubs.g.cs 位于 /obj 文件夹中,因此在两个文件中生成相同的类.

          只需删除旧的 RefitStubs.cs 文件,您就可以开始使用了。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2019-01-17
            • 1970-01-01
            • 1970-01-01
            • 2017-07-31
            • 2016-06-03
            • 1970-01-01
            相关资源
            最近更新 更多