How to mark a file as an embedded resource in Visual Studio Code?

杀马特。学长 韩版系。学妹 提交于 2021-02-10 16:00:09

问题


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.


回答1:


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

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

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)



来源:https://stackoverflow.com/questions/49479476/how-to-mark-a-file-as-an-embedded-resource-in-visual-studio-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!