VSTO:安装 Outlook Office 2003 加载项

发布于 2024-07-27 05:43:25 字数 7657 浏览 5 评论 0原文

我在这里发布了一篇文章(如何设置我的 VSTO Outlook 加载项的权限?),我能够构建我的安装程序。 我认为一旦安装程序自行构建,一切都会正常工作。

我错了。 它可以在我运行过安装程序的大约一半电脑上运行。 我的问题是另一半不起作用。 我正在尝试安装 Outlook Office 2003 的加载项。

我什至使用批处理文件手动创建这些步骤。 在这些 PC 上似乎没有任何东西可以工作,我找不到可以排除的共同点,或者可以使 VSTO Addin 工作的共同点。

这是我正在使用的批处理文件。 我这样做/没有做错什么?

我确实需要 VSTO 专家的帮助。 谢谢!!!!

编辑我更改了批处理文件和注册表设置以反映最近的更新。 我还附上了来自无法工作的电脑的错误文本。

@echo off

echo Installing Visual Studio for Office Runtime (SE 2005)...
..\VSTO\vstor.exe

echo Creating Directories...
mkdir "c:\program files\Project Archiver"

echo Installying Add-In... 
echo Copying files...
xcopy /Y *.dll "c:\program files\Project Archiver"
xcopy /Y *.manifest "c:\program files\Project Archiver"

echo Setting Security...
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe" -polchgprompt off
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe" -u -ag All_Code -url "c:\program files\Project Archiver\ProjectArchiver.dll" FullTrust -n "Project Archiver" -d "Outlook plugin for archiving"
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe" -u -ag All_Code -url "c:\program files\Project Archiver\Microsoft.Office.Interop.SmartTags.dll" FullTrust -n "Project Archiver" -d "Outlook plugin for archiving"
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe" -polchgprompt on

echo Loading Registry Values...
"c:\program files\Project Archiver\VSTO_settings.reg"

echo "That should do it."
pause

我直接从该应用程序运行的 PC 上获取注册表设置(在上面的批处理文件中提到)。 我正在使用的 VSTO 注册表设置是:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\ProjectArchiver\CLSID]
@="{27830B8D-F7A1-4945-AC4A-47661B9ED36D}"

[HKEY_CLASSES_ROOT\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}]
@="ProjectArchiver -- an addin created with VSTO technology"

[HKEY_CLASSES_ROOT\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\InprocServer32]
@=hex(2):25,00,43,00,6f,00,6d,00,6d,00,6f,00,6e,00,50,00,72,00,6f,00,67,00,72,\
  00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,25,00,5c,00,4d,00,69,00,63,00,\
  72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,53,00,68,00,61,00,72,00,65,00,64,\
  00,5c,00,56,00,53,00,54,00,4f,00,5c,00,38,00,2e,00,30,00,5c,00,41,00,64,00,\
  64,00,69,00,6e,00,4c,00,6f,00,61,00,64,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
  00,00,00
"ManifestName"="ProjectArchiver.dll.manifest"
"ThreadingModel"="Both"
"ManifestLocation"="C:\\Program Files\\Project Archiver\\"

[HKEY_CLASSES_ROOT\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\ProgID]
@="ProjectArchiver"

[HKEY_CLASSES_ROOT\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\Programmable]

[HKEY_CLASSES_ROOT\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\VersionIndependentProgID]
@="ProjectArchiver"

[HKEY_CLASSES_ROOT\ProjectArchiver]
@=""





[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}]
@="ProjectArchiver -- an addin created with VSTO technology"

[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\InprocServer32]
@=hex(2):25,00,43,00,6f,00,6d,00,6d,00,6f,00,6e,00,50,00,72,00,6f,00,67,00,72,\
  00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,25,00,5c,00,4d,00,69,00,63,00,\
  72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,53,00,68,00,61,00,72,00,65,00,64,\
  00,5c,00,56,00,53,00,54,00,4f,00,5c,00,38,00,2e,00,30,00,5c,00,41,00,64,00,\
  64,00,69,00,6e,00,4c,00,6f,00,61,00,64,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
  00,00,00
"ManifestName"="ProjectArchiver.dll.manifest"
"ThreadingModel"="Both"
"ManifestLocation"="C:\\Program Files\\Project Archiver\\"

[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\ProgID]
@="ProjectArchiver"

[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\Programmable]

[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\VersionIndependentProgID]
@="ProjectArchiver"

[HKEY_LOCAL_MACHINE\Software\Classes\ProjectArchiver]
@=""

[HKEY_LOCAL_MACHINE\Software\Classes\ProjectArchiver\CLSID]
@="{27830B8D-F7A1-4945-AC4A-47661B9ED36D}"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Office\Outlook\Addins\ProjectArchiver]
"Manifest"="C:\\Program Files\\Project Archiver\\ProjectArchiver.dll.manifest"
"LoadBehavior"=dword:00000003
"FriendlyName"="ProjectArchiver"
"Description"="ProjectArchiver -- an addin created with VSTO technology"
"CommandLineSafe"=dword:00000001

我得到的错误是:

无法加载文件或程序集“Microsoft.Office.Interop.Outlook,Version=11.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c”或其依赖项之一。 系统找不到指定的文件。

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Office.Interop.Outlook, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
   at ProjectArchiver.ThisAddIn.Initialize()
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.CreateStartupObject(EntryPoint entryPoint, Dependency dependency, Assembly objectAssembly)
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ConfigureAppDomain()
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadAssembliesAndConfigureAppDomain(IHostServiceProvider serviceProvider)
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadEntryPointsHelper(IHostServiceProvider serviceProvider)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].



************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
    CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.816
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll
----------------------------------------
Microsoft.Office.Tools.Common
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.816
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/8.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
ProjectArchiver
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/Callidus/Project%20Archiver/ProjectArchiver.DLL
----------------------------------------

I posted an article here (How do I set permissions on my VSTO outlook add-in?) and I was able to build my installer. I thought that once the installer built itself, everything would work fine.

I was wrong. It works on about half of the PC's I've run the installer on. My problem is that the other half doesn't work. I'm trying to install an add-in to Outlook Office 2003.

I've even gone so far as to create the steps manually by using a batch file. Nothing seems to work on these PCs and I can't find a common denominator that I can rule out or in that will make the VSTO Addin work.

Here is the batch file I am using. What am I doing/not-doing wrong with this?

I could really use a VSTO expert's help. Thanks!!!!

EDIT I've changed the batch file and registry settings to reflect recent updates to them. I've also attached the error text that comes from the PCs that don't work.

@echo off

echo Installing Visual Studio for Office Runtime (SE 2005)...
..\VSTO\vstor.exe

echo Creating Directories...
mkdir "c:\program files\Project Archiver"

echo Installying Add-In... 
echo Copying files...
xcopy /Y *.dll "c:\program files\Project Archiver"
xcopy /Y *.manifest "c:\program files\Project Archiver"

echo Setting Security...
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe" -polchgprompt off
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe" -u -ag All_Code -url "c:\program files\Project Archiver\ProjectArchiver.dll" FullTrust -n "Project Archiver" -d "Outlook plugin for archiving"
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe" -u -ag All_Code -url "c:\program files\Project Archiver\Microsoft.Office.Interop.SmartTags.dll" FullTrust -n "Project Archiver" -d "Outlook plugin for archiving"
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe" -polchgprompt on

echo Loading Registry Values...
"c:\program files\Project Archiver\VSTO_settings.reg"

echo "That should do it."
pause

I took the Registry settings (mentioned in the batch file above) straight from a PC that this application worked on. The VSTO Registry settings I am using are :

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\ProjectArchiver\CLSID]
@="{27830B8D-F7A1-4945-AC4A-47661B9ED36D}"

[HKEY_CLASSES_ROOT\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}]
@="ProjectArchiver -- an addin created with VSTO technology"

[HKEY_CLASSES_ROOT\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\InprocServer32]
@=hex(2):25,00,43,00,6f,00,6d,00,6d,00,6f,00,6e,00,50,00,72,00,6f,00,67,00,72,\
  00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,25,00,5c,00,4d,00,69,00,63,00,\
  72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,53,00,68,00,61,00,72,00,65,00,64,\
  00,5c,00,56,00,53,00,54,00,4f,00,5c,00,38,00,2e,00,30,00,5c,00,41,00,64,00,\
  64,00,69,00,6e,00,4c,00,6f,00,61,00,64,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
  00,00,00
"ManifestName"="ProjectArchiver.dll.manifest"
"ThreadingModel"="Both"
"ManifestLocation"="C:\\Program Files\\Project Archiver\\"

[HKEY_CLASSES_ROOT\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\ProgID]
@="ProjectArchiver"

[HKEY_CLASSES_ROOT\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\Programmable]

[HKEY_CLASSES_ROOT\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\VersionIndependentProgID]
@="ProjectArchiver"

[HKEY_CLASSES_ROOT\ProjectArchiver]
@=""





[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}]
@="ProjectArchiver -- an addin created with VSTO technology"

[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\InprocServer32]
@=hex(2):25,00,43,00,6f,00,6d,00,6d,00,6f,00,6e,00,50,00,72,00,6f,00,67,00,72,\
  00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,25,00,5c,00,4d,00,69,00,63,00,\
  72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,53,00,68,00,61,00,72,00,65,00,64,\
  00,5c,00,56,00,53,00,54,00,4f,00,5c,00,38,00,2e,00,30,00,5c,00,41,00,64,00,\
  64,00,69,00,6e,00,4c,00,6f,00,61,00,64,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
  00,00,00
"ManifestName"="ProjectArchiver.dll.manifest"
"ThreadingModel"="Both"
"ManifestLocation"="C:\\Program Files\\Project Archiver\\"

[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\ProgID]
@="ProjectArchiver"

[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\Programmable]

[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{27830B8D-F7A1-4945-AC4A-47661B9ED36D}\VersionIndependentProgID]
@="ProjectArchiver"

[HKEY_LOCAL_MACHINE\Software\Classes\ProjectArchiver]
@=""

[HKEY_LOCAL_MACHINE\Software\Classes\ProjectArchiver\CLSID]
@="{27830B8D-F7A1-4945-AC4A-47661B9ED36D}"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Office\Outlook\Addins\ProjectArchiver]
"Manifest"="C:\\Program Files\\Project Archiver\\ProjectArchiver.dll.manifest"
"LoadBehavior"=dword:00000003
"FriendlyName"="ProjectArchiver"
"Description"="ProjectArchiver -- an addin created with VSTO technology"
"CommandLineSafe"=dword:00000001

The error I get is:

Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Office.Interop.Outlook, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
   at ProjectArchiver.ThisAddIn.Initialize()
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.CreateStartupObject(EntryPoint entryPoint, Dependency dependency, Assembly objectAssembly)
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ConfigureAppDomain()
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadAssembliesAndConfigureAppDomain(IHostServiceProvider serviceProvider)
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadEntryPointsHelper(IHostServiceProvider serviceProvider)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].



************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
    CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.816
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll
----------------------------------------
Microsoft.Office.Tools.Common
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.816
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/8.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
ProjectArchiver
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/Callidus/Project%20Archiver/ProjectArchiver.DLL
----------------------------------------

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

妖妓 2024-08-03 05:43:25

好的,显然 Outlook 自动禁用了该 AddIn。 另一个答案略有不同:

转到“开始”->“ 控制面板-> 系统-> 高级-> 环境
变量-> 系统变量,并添加值为 0 的 VSTO_SUPPRESSDISPLAYALERTS。这将在屏幕上显示错误消息,而不是静默禁用 VSTO。 如果您希望将日志写入磁盘,请添加 VSTO_LOGALERTS 并将其设置为 1。

希望这将为您提供一些额外的详细信息,帮助我们解决您的问题!

Ok, so apparently the AddIn gets automatically disabled by Outlook. Another answer with a slightly different take:

Go to Start -> Control Panel -> System -> Advanced -> Environment
Variables -> System Variables, and add VSTO_SUPPRESSDISPLAYALERTS with a value of 0. This will display error messages on screen, as opposed to silently disabling the VSTO. If you'd rather have a log to disk, add VSTO_LOGALERTS and set it to 1.

Hopefully this will provide you with some extra detail that might help us solve your issue!

话少心凉 2024-08-03 05:43:25

从一些琐碎的事情开始:在电脑上出现问题时,您是否检查了注册表以查看是否所有条目都已正确添加? 例如,.bat 文件是否在实际允许写入 HKEY_CLASSES_ROOT 的帐户下运行?

这些 PC 中是否有运行 Vista 的电脑? 他们是否在没有 UAC 的情况下运行 Office 套件,或者使用完整的管理员帐户? 在这种情况下,应将条目添加到 HKEY_LOCAL_MACHINE 中。

编辑

好的,如果您确定已将内容正确添加到注册表中,下一步是RegMon(如果您愿意,也可以使用 procmon)。 启动 regmon,启动 Office 主机应用程序,然后查看它在哪里以及是否在寻找 VSTO 加载项。 首先根据您的加载项名称进行筛选,然后根据数据量扩大或缩小范围。

To start with something trivial: on the PC's where things didn't work, did you check the registry to see if all the entries were properly added? For instance, did the .bat file get run under an account that is actually allowed writing to HKEY_CLASSES_ROOT?

Are any of those PC's running Vista? Could it be they are running the Office suite without UAC, or with a full administrator account? In that case, the entries should be added to the HKEY_LOCAL_MACHINE.

Edit

Ok, if you are sure things are added to the registry properly, next up is RegMon (or procmon if you so prefer). Fire up regmon, start the office host application, and see where it is and isn't looking for the VSTO add-in. Start off with a filter based on your add-in name, then widen up or narrow down depending on the amount of data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文