在项目模板中使用本地 IWizard 程序集作为 WizardExtension
我有一个非常简单的 IWizard
实现,其唯一目的是将参数变量添加到字典中(不需要用户交互)。
如果可能的话,我不想将其添加到 GAC。
我将 dll
与 vstemplate
文件一起放置在模板 zip 文件的根目录中,并在 WizardExtension
部分引用了该名称:
<WizardExtension>
<Assembly>Wizard.dll</Assembly>
<FullClassName>Wizard.Wizard</FullClassName>
</WizardExtension>
我希望这将找到并使用程序集的本地副本,但它似乎不起作用。
有没有办法在不安装到 GAC 的情况下使用 IWizard
实现?
I have a very simple IWizard
implementation with sole the purpose of adding a parameter variable to the dictionary (no user interaction is required).
I don't want to have to add this to the GAC if possible.
I placed the dll
in the root of the template zip file with the vstemplate
file and have referenced the name in the WizardExtension
section:
<WizardExtension>
<Assembly>Wizard.dll</Assembly>
<FullClassName>Wizard.Wizard</FullClassName>
</WizardExtension>
I was hoping that this would find and use the local copy of the assembly, but it doesn't appear to work.
Is there any way of using an IWizard
implementation without installing to the GAC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我终于检查了描述的解决方案 在这里。
我们的想法是,我们必须将实现 IWizard 的程序集添加到 GAC 或 Visual Studio 使用程序集探测机制查找的任何其他位置。 VS 在 C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE 附近查找我们的模板程序集 (devenv.exe)。它还会查找两个子目录:
PrivateAssemblies
和PublicAssemblies
。我不确定是否需要使用强名称密钥对我们的程序集进行签名(在我的情况下我使用已签名的密钥)。您可以轻松检查。
因此,如果我没记错的话,不可能强制直接从模板 zip 文件使用程序集。为了使模板的使用和更新更容易,我将创建一个小型安装项目。
最后一点。 据我所知,您不能在 Assembly 标记中指定程序集的 .dll 扩展名。以下是我为向导扩展程序集编写 vstemplate 部分的方法:
I have finally checked the solution described here.
The idea is that we must add the assembly which implements the IWizard to the GAC or to any other place which Visual Studio looks using the assembly probing mechanism. VS looks for our template assembly near itself (devenv.exe) at
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE
. It also looks in two subdirectories:PrivateAssemblies
andPublicAssemblies
.I'm not sure whether it is required to sign our assembly with a strong name key or not (I use the signed one in my case). You can check it easily.
So, if I am not mistaken, it isn't possible to force the assembly to be used directly from your template zip file. In order to make the usage and update of my template easier I'm going to create a small setup project.
Last note. As far as I know, you mustn't specify the .dll extension of your assembly in the Assembly tag. Here is how I write a vstemplate part for my wizard extension assembly:
我知道这有点旧了(并且线程发起者已经放弃了这个问题),但是解决这个问题的一种非常迷人的方法是使用 导出模板向导。您可以将项目模板导出为 VSIX 插件,并将向导程序集与插件一起打包。无需通过这种方式在 GAC 中注册。
I know this is kind of old (and the thread starter has given up on the matter), but one extremely charming way to solve this is using Export Template Wizard. You can export your project template as a VSIX plugin and have the wizard assembly packaged along with the plugin. No need to register it in the GAC that way.