将Visual Studio项目转换为Dot Net Core项目 csproj to xproj

  1. 删除csproj文件。
  2. 将 package.config 重命名为 project.json 。
  3. 转换文件,将xml转换为json格式。
  4. <?xml version="1.0" encoding="utf-8"?>
    <packages>
      <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net451" />
      <package id="SomeCoolPackage" version="3.0.1" targetFramework="net451" />
    </packages>

    转换之后

    {
      "dependencies": {
        "SomeCoolPackage": "3.0.1",
        "Newtonsoft.Json": "8.0.3"
      },
      "frameworks": {
        "net45": {
        }
      },
      "runtimes": {
        "win": { }
      }
    }
  5. 执行 dotnet restore
  6. 执行 dotnet build
  7. 你可能会遇到错误,尝试添加对Frmework的引用
    {
      "dependencies": {
        "SomeCoolPackage": "3.0.1",
        "Newtonsoft.Json": "8.0.3"
      },
      "frameworks": {
     "net45": {
          "frameworkAssemblies": {
            "System.Runtime.Serialization": "4.0.0.0",
          }
        }
      },
      "runtimes": {
        "win": { }
      }
    }
  8. 打开Visual Studio,添加现有项目。

转载于:https://www.cnblogs.com/Soar1991/p/5635645.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值