本文介绍了在ASP.NET 1.0核心参考图书馆(vNext)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我学习ASP.NET 1.0的核心(vNext)。考虑到这一点,我有一个结构化的这样一个解决方案:

  MySolution 
SRC
在MyLibrary
MyClass.cs
project.json
MyWebSite
Startup.cs
project.json

我成功编译在MyLibrary 使用命令行 DNU建立。我跑了 DNU包即生成 MyLibrary.1.0.0.nupkg 。也有两个文件夹: dnx451 dnxcore50 其中都包含 MyLibrary.1.0.0。 DLL 。我想用在MyLibrary MyWebSite ,但是,我很困惑。




  1. 如何包括在MyLibrary MyWebSite ?难道我手动在的.dll 文件复制?如果是这样,哪一个?我应该使用 nupkg 文件呢?这是一个私人集会,我不想通过的NuGet全球发布。

  2. 我怎么把在 MyWebSite / project.json 引用在MyLibrary 组装?


解决方案

您不必发布包的NuGet,如果你不希望与您的解决方案之外的其他人/项目共享它。你可以只直接从源引用包



然而,如果仍然不能为你工作,那么你有三种选择:




  1. 使用内部化罗斯林。例如:和的

  2. 您可以参考直接来源。例如

  3. 创建一个构建时间依赖性。例如并的


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
      project.json
    MyWebSite
      Startup.cs
      project.json

I am successfully compiling MyLibrary from the command-line using dnu build. I ran dnu pack which generated MyLibrary.1.0.0.nupkg. There are also two folders: dnx451 and dnxcore50 which both contain MyLibrary.1.0.0.dll. I want to use MyLibrary in MyWebSite, however, I'm confused.

  1. How do I "include" MyLibrary into MyWebSite? Do I manually copy over the .dll file? If so, which one? Should I use the nupkg file instead? This is a private assembly, I do not want to publish it globally via NuGet.
  2. What do I put in MyWebSite/project.json to reference the MyLibrary assembly?
解决方案

You don't have to publish the package to NuGet if you don't want to share it with other people/projects outside of your solution. You can just reference the package directly from source.

However, if that still doesn't work for you then you have three options:

  1. Internalize using Roslyn. Example: project.json and the actual code
  2. You can reference the sources directly. Example project.json
  3. Create a build time dependency. Example project.json and actual code for the package

这篇关于在ASP.NET 1.0核心参考图书馆(vNext)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 18:13