更新卫星程序集而不重新编译
我有一个类库项目,许多其他 Web 应用程序都使用该项目。我想为该类库创建一个附属程序集。当我更改资源字符串之一时,我不想重新编译/重新部署类库。
虽然我认为我理解卫星组装的概念,但我不明白如何构建它以便我可以按照我想要的方式使用它。
默认情况下,当您将资源文件添加到 Visual Studio 中的项目时,它将其生成操作设置为“嵌入资源”。
因此,我的项目名为 MyProject
。我有一个名为 MyProject.Resources.resx
的默认资源文件和另一个名为 MyProject.Resources.fr.resx
的资源文件。
当我构建时,我得到的只是 MyProject.dll
和一个带有 MyProject.resources.dll
的“fr”子文件夹。
所以我的理解是主程序集(MyProject.dll)包含默认资源,因为它被设置为嵌入资源。但是,如果不重新部署整个程序集,我就无法更新资源,这对我不利。
我在 MSDN 上阅读了有关使用 AL.exe 打包程序集的信息,但我仍然不明白:
如何设置 Visual Studio,以便它将我的资源文件作为与主程序集不同的文件输出?从我在 MSDN 上读到的内容来看,我需要 .resource 文件,但我不太确定。
一旦我按照我想要的方式得到它,如果我想修改资源文件,我该怎么办?我想我会更新 Visual Studio 中的资源,构建项目并仅复制目标服务器上的资源 DLL,对吗?我是否可以将它们与 MyProject.dll
一起直接复制到 GAC 中,并且一切仍然可以正常工作?
谢谢!
I have a Class Library project that is used by many other web applications. I want to create a satellite assemblies for that class library. I don't want to have to recompile / redeploy the class library when I change one of the resource strings.
While I think I understand the concept of satellite assembly, I don't understand how to build it so that I can use it the way I want.
By default, when you add a resource file to a project in Visual Studio, it sets its build action to "Embedded Resource".
So, my project is called MyProject
. I have a default resource file called MyProject.Resources.resx
and another one called MyProject.Resources.fr.resx
.
When I build, all I get is MyProject.dll
and a "fr" subfolder with MyProject.resources.dll
.
So the way I understand it is that the main assembly (MyProject.dll) contains the default resources because it is set as embedded resource. However, I can't update the resources without redeploying the whole assembly which isn't good for me.
I read on MSDN about packaging assemblies using AL.exe but I still don't understand :
How do I set visual studio so that it outputs my resource files as separate files from the main assembly? From what I read on MSDN, I need .resource files but i'm not quite sure.
Once I do get it the way I want, what would I do if I wanted to modify a resource file? I suppose I would update the resource in visual studio, build the project and copy only the resource DLLs on the target server, is that correct? Would I be able to copy them directly in the GAC along with MyProject.dll
and everything would still work fine?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论