將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,添加現有項目。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM