簡體   English   中英

netcoreapp1.0中的參考FrameworkAssembly

[英]Reference FrameworkAssembly in netcoreapp1.0

在僅運行Windows的netcoreapp上引用完整框架程序集(如System.DirectoryServices.AccountManagement )的首選方法是什么?

dnx支持這種方式:

 "frameworks": {
    "dnx451": {
      "frameworkAssemblies": {
        "System.DirectoryServices.AccountManagement": "4.0.0.0",
        "System.Messaging": "4.0.0.0",
        "System.Runtime.Serialization": "4.0.0.0"
      }
    }
  },

並使用netcore將其更改為:

 "dependencies": {
    "NETStandard.Library": "1.5.0-rc2-24027"
  },

  "frameworks": {
    "netstandard1.5": {
      "imports": "dnxcore50"
    }
  }

使用frameworkAssemblies仍然適合我。

如果要直接從ASP.NET Core應用程序使用程序集,那么project.json將如下所示:

"dependencies": {
  "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
  "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final"
},

"frameworks": {
  "net461": {
    "frameworkAssemblies": {
      "System.DirectoryServices.AccountManagement": "4.0.0.0"
    }
  }
},

如果你想通過類庫間接進行,那么類庫中的project.json將如下所示:

"dependencies": {
  "NETStandard.Library": "1.5.0-rc2-24027"
},

"frameworks": {
  "net461": {
    "frameworkAssemblies": {
      "System.DirectoryServices.AccountManagement": "4.0.0.0"
    }
  }
}

在應用程序中(假設類庫稱為ClassLibrary ):

"dependencies": {
  "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
  "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
  "ClassLibrary": "1.0.0-*"
},

"frameworks": {
  "net461": {}
},

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM