问题描述
我学习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
,但是,我很困惑。
- 如何包括
在MyLibrary
到MyWebSite
?难道我手动在的.dll
文件复制?如果是这样,哪一个?我应该使用nupkg
文件呢?这是一个私人集会,我不想通过的NuGet全球发布。 - 我怎么把在
MyWebSite / project.json
引用在MyLibrary
组装?
您不必发布包的NuGet,如果你不希望与您的解决方案之外的其他人/项目共享它。你可以只直接从源引用包
然而,如果仍然不能为你工作,那么你有三种选择:
- 使用内部化罗斯林。例如:和的
- 您可以参考直接来源。例如
- 创建一个构建时间依赖性。例如并的
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.
- How do I "include"
MyLibrary
intoMyWebSite
? Do I manually copy over the.dll
file? If so, which one? Should I use thenupkg
file instead? This is a private assembly, I do not want to publish it globally via NuGet. - What do I put in
MyWebSite/project.json
to reference theMyLibrary
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:
- Internalize using Roslyn. Example: project.json and the actual code
- You can reference the sources directly. Example project.json
- Create a build time dependency. Example project.json and actual code for the package
这篇关于在ASP.NET 1.0核心参考图书馆(vNext)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!