如何在 Visual Studio Code 中将文件标记为嵌入资源? [英] How to mark a file as an embedded resource in Visual Studio Code?

查看:39
本文介绍了如何在 Visual Studio Code 中将文件标记为嵌入资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 c# 库,并尝试使用 Visual Studio Code.我通常喜欢我所看到的,但有些事情让我感到沮丧,这在 Visual Studio 标准版本中非常容易......例如,将文件标记为嵌入式资源.

I'm writing a c# library, and trying out Visual Studio Code. I'm generally liking what I'm seeing, but there are some things that I'm finding frustrating, that are really easy in Visual Studio standard version... for example, marking a file as an embedded resource.

如果没有一些复杂的巫毒教,这可能吗?我需要安装扩展程序吗?这对我来说并不明显.

Is this possible without some complicated voodoo? Is there an extension I need to install? It's not obvious to me.

推荐答案

您必须编辑 .csproj 并将代表您的文件的节点更改为

You have to edit the .csproj and change the node that represents your file to

<EmbeddedResource Include="Resources\yourEmbeddedResource.json" />

如果您的 c#-library-project 使用旧的项目类型,您应该为您的文件找到一个内容节点或无节点,因为此项目类型需要在 csproj 中添加的所有文件.如果您有更新且更短的项目类型,您的文件可能不会被列出,因为这种类型会自动收集它的项目文件.你可能需要添加这个节点(记得把它包裹在一个 itemgroup 中)

If your c#-library-project uses the older project-type you should find a content-node or none-node for your file because this project type needs all files added in the csproj. If you have the newer and far mor shorter project-type your file may not be listed because this type auto collects it's project files. You may have to add this node (remember to wrap it inside an itemgroup)

这篇关于如何在 Visual Studio Code 中将文件标记为嵌入资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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