问题描述
在 VS 2012 中安装扩展后,它被放置在 %userprofile%AppData\Local\Microsoft\VisualStudio\11.0\Extensions\
(或在 C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions
(如果为所有用户安装了它)和随机名称的文件夹,如hilatg23.234"或kcsuvnvi.qtq".有没有办法指定这个文件夹的名称并使这个扩展安装到像 %userprofile%AppData\Local\Microsoft\VisualStudio\11.0\Extensions\MY_EXTENSION_NAME
After installing extension in VS 2012 it is placed in %userprofile%AppData\Local\Microsoft\VisualStudio\11.0\Extensions\
(or in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions
if it is installed for all users) and in folder with random name like "hilatg23.234" or "kcsuvnvi.qtq". Is there a way to specify the name of this folder and make this extension to install to folder like %userprofile%AppData\Local\Microsoft\VisualStudio\11.0\Extensions\MY_EXTENSION_NAME
推荐答案
嗯,别这么想.VSIX 安装程序将始终自动选择安装目录.如果你想让用户决定安装文件夹,你需要创建一个 MSI
安装包.
Hm, don´t think so. The VSIX installer will always choose the installation directory automatically. If you want to let the user decide about the installation folder, you´d need to create a MSI
installation package.
前段时间我回答了另一个关于包注册的问题;也许提供的一些信息可能有助于创建这样的设置.请参阅以下帖子:MSI 安装的 VSPackage 仅在实验实例中加载
A while ago I answered another question regards the package registration; maybe some of the provided information might help to create such a setup. See post at: MSI installed VSPackage is loaded in Experimental Instance only
如果你只想在运行时获取包安装文件夹,你可以从包的汇编代码库中获取,例如:
If you just want to obtain the package installation folder at runtime, you can just get it from the package´s assembly codebase, like:
private static string ObtainInstallationFolder()
{
Type packageType = typeof(MyPackage);
Uri uri = new Uri(packageType.Assembly.CodeBase);
var assemblyFileInfo = new FileInfo(uri.LocalPath);
return assemblyFileInfo.Directory.FullName;
}
这篇关于指定VS扩展安装目录名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!