Referencing Library in ASP.NET Core 1.0 (vNext)

后端 未结 3 2224
离开以前
离开以前 2021-02-19 11:44

I am learning ASP.NET Core 1.0 (vNext). With that in mind, I have a solution that is structured like this:

MySolution
  src
    MyLibrary
      MyClass.cs
               


        
3条回答
  •  [愿得一人]
    2021-02-19 12:38

    1. Several questions marked in bold.

    (How do I "include" MyLibrary into MyWebSite?) In MyWebSite/project.json: Add the reference like this (don't worry about the version number not showing up). Add VS2015RC class library reference

    (Do I manually copy over the .dll file?)

    No

    (This is a private assembly, I do not want to publish it globally via NuGet.)

    Then don't do that :)

    Referencing your class library from your web application will make sure it is included when building the web application. Then you should copy your web application files to an application server able to run it. I think you should try to publish your web application to an Azure Web app and then use server explorer to look at what the files on the server looks like after publishing. Or did you already know there is no reason to make a package before using it in you web app?

提交回复
热议问题