Visual Studio 2017:“xx中存在类型xx”迁移后 [英] Visual Studio 2017: "the type xx exists in both" after migration

查看:55
本文介绍了Visual Studio 2017:“xx中存在类型xx”迁移后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我开始迁移我的"旧" .net核心网络应用程序从vs.net 105到vs.net 2017 rc ......问题就开始了!在"旧"中xproj版本我的类库再次构建了net451,net46和net461框架:这里是project.json
文件:

Hello everybody, I start migrating my "old" .net core web app from vs.net 105 to vs.net 2017 rc...and the problems begin! In "old" xproj version my class libraries were built again net451, net46 and net461 frameworks : here is the project.json file:

{

  "version":" 1.0.2.0",

  "description":""XXX",

  "作者":[和"管理员"; ],

  " packOptions":{

    "tags":[],

    " licenseUrl":""

  },



  "框架":{

    "net451":{

      " frameworkAssemblies":{

        "System.Runtime":" 4.0.10.0"

      }

    },

    "net46":{

      " frameworkAssemblies":{

        "System.Runtime":" 4.0.20.0"

      }

    },

    "net461":{

      " frameworkAssemblies":{

        "System.Runtime":" 4.0.20.0"

      }

    }

  },

  "依赖关系":{

    "Microsoft.ApplicationInsights":" 2.3.0-beta1",

    "Microsoft.Rest.ClientRuntime":" 2.3.4"

  },

  " buildOptions":{

    "编译":{

      "include":[

        " ../../../ Tracing / *。cs"

      ]

    }

  }

}

{
  "version": "1.0.2.0",
  "description": "XXX",
  "authors": [ "Administrator" ],
  "packOptions": {
    "tags": [],
    "licenseUrl": ""
  },

  "frameworks": {
    "net451": {
      "frameworkAssemblies": {
        "System.Runtime": "4.0.10.0"
      }
    },
    "net46": {
      "frameworkAssemblies": {
        "System.Runtime": "4.0.20.0"
      }
    },
    "net461": {
      "frameworkAssemblies": {
        "System.Runtime": "4.0.20.0"
      }
    }
  },
  "dependencies": {
    "Microsoft.ApplicationInsights": "2.3.0-beta1",
    "Microsoft.Rest.ClientRuntime": "2.3.4"
  },
  "buildOptions": {
    "compile": {
      "include": [
        "../../../Tracing/*.cs"
      ]
    }
  }
}

迁移后,我遇到了很多构建错误:

After migration i get a lot of build errors all like this:

严重性 代码
描述 项目
文件
抑制状态

错误 CS0433
类型'HttpClientHandler'存在于'System.Net.Http,Version中= 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'和'System.Net.Http,Version = 4.1.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'
WebApiServiceClient(net46),WebApiServiceClient(net461)

Severity Code Description Project File Line Suppression State
Error CS0433 The type 'HttpClientHandler' exists in both 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' WebApiServiceClient(net46), WebApiServiceClient(net461)

如果我针对单个框架构建(更改 TargetFrameworks to  TargetFramework  并使用例如net451)它可以工作。

If I build against a single framework (change TargetFrameworks to TargetFramework  and use for example net451) it works.

以下是迁移后的csproj:

Here is the csproj after migration:

VS.NET 2017 RC是15.0.26020.0

VS.NET 2017 RC is 15.0.26020.0

任何帮助?

推荐答案

您好Simone Cherici,

Hi Simone Cherici,

根据您的描述,我建议您可以使用VS2017RC直接打开项目。通过此步骤查看结果。

According to your description, I suggest you could use VS2017RC to open the project directly. With this step to see the results.

此致,

奥斯卡


这篇关于Visual Studio 2017:“xx中存在类型xx”迁移后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆