如何从 .Net Core RC2 类库创建 NuGet 包 [英] How to Create NuGet Packages From .Net Core RC2 Class Libraries

查看:22
本文介绍了如何从 .Net Core RC2 类库创建 NuGet 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 中有一个包含 12 个项目的解决方案.我想从 Visual Studio 创建一个 nuget 包,但似乎缺少来自 RC1 的生成输出".

I have a solution in Visual Studio with 12 projects. I would like to create a nuget package from Visual Studio, but it appears the "Produce outputs on build" that was there from RC1 is missing.

我可以继续创建一个脚本,该脚本转到每个文件夹并调用dotnet pack",但是 Visual Studio 中是否有我缺少的选项来执行此操作?

I can go ahead and create a script that goes to each folder and call "dotnet pack", but is there an option in Visual Studio that I am missing to do this?

推荐答案

将此添加到您的 project.json 文件中:

Add this to your project.json file:

"scripts": {
  "postcompile": [
    "dotnet pack --no-build --configuration %compile:Configuration%"
  ]
}

这将运行 dotnet pack 命令,该命令会将编译后生成的构建输出打包到 NuGet 包中.有关详细信息,请参阅.

This will run the dotnet pack command which will pack your build output produced after compilation into a NuGet package. For more info, see this.

我不确定如何只在发布模式下执行此操作,所以我问了这个问题 此处.

I'm not sure how to only do this in release mode, so I've asked that question here.

更新

根据另一个问题更新了答案.

Updated the answer based on the other question.

这篇关于如何从 .Net Core RC2 类库创建 NuGet 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆