如何在 .NET Core 库中添加文件作为链接? [英] How do you add a file as a link in a .NET Core library?

查看:29
本文介绍了如何在 .NET Core 库中添加文件作为链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的解决方案中添加了一个 .NET Core RC2 类库(为了好玩),我通常做的第一件事是添加一个链接到共享的 GlobalAssemblyInfo.cs 并编辑现有的 AssemblyInfo.cs 到程序集细节.

I've added a .NET Core RC2 class lib to my solution (for fun) and the first thing I usually do is add a link to a shared GlobalAssemblyInfo.cs and edit the existing AssemblyInfo.cs down to the assembly specifics.

所以我刚刚完成了添加"->现有项目",找到了我的文件并单击了添加按钮的下拉菜单.没有添加为链接"选项.

So I've just done "Add"->"existing item", located my file and clicked the dropdown of the add button. No "Add as Link" option.

怎么了?如何使用 .NET Core 执行此操作?

What's the deal? How do I do this with .NET Core?

推荐答案

我认为该工具尚不支持此功能,不幸的是,文档尚未更新.

I don’t think the tooling supports this yet, and unfortunately, the documentation is not up to date on this yet.

但是,您可以通过此 ASP.NET Core 公告了解其工作原理.基本上,您可以将单独的文件路径添加到 project.json 中的 buildOptions.compile.includeFiles 设置:

However, you can get an idea on how this works from this ASP.NET Core announcement. Basically, you can add individual file paths to the buildOptions.compile.includeFiles setting in your project.json:

{
    "buildOptions": {
        // …
        "compile": {
            // …
            "includeFiles": [
                // …
                "../shared/GlobalAssemblyInfo.cs"
            ]
         }
     }
}

这篇关于如何在 .NET Core 库中添加文件作为链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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