首页 新闻 会员 周边 捐助

64位Excel Automation Add In无效

0
悬赏园豆:50 [已关闭问题] 关闭于 2010-03-12 19:27

我做了一个Excel 2010 x64的插件,是一个自定义公式,结果在Excel中点击【Automation】添加时总是提示:

xxx.dll is not a valid Add-In

 

代码如下:

代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using Microsoft.Win32;

namespace UDFDemo
{
[ComVisible(
true), GuidAttribute("E8E9F986-97AA-4c22-A3A3-8C67991BD152")]
[ProgId(
"UDFDemo.UDFDemo.1")]
[ClassInterface(ClassInterfaceType.AutoDual)]
public class UDFDemo
{
public double fnDiv(double num, int times, double result)
{
if (times <= 0)
{
throw new Exception("times必须为正整数!");
}

for (int i = 0; i < times; i++)
{
result
+= num / times;
}
return result;
}
}
}

 

 

使用的WIX脚本生成MSI安装文件注册的:

开发环境:

Windows Server 2008 R2 DataCenter

Office 2010 Professional Plus Beta x64

Visual Studio 2010 Beta2

我不太明白,什么样的Add-In是有效的?希望朋友们帮忙看看,先谢了。

PS:因为是64位的Excel,故只能制作64位的Add-In.

代码
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="a1d9e4c2-74ea-4176-9c8a-deb3c3a3fde1" Name="UDFMSI" Language="1033" Version="1.0.0.0" Manufacturer="UDFMSI" UpgradeCode="e2b52d40-53e3-422b-a7c9-35377e47ddc5">
<Package InstallerVersion="300" Compressed="yes" Platform="x64" />

<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLLOCATION" Name="UDFMSI">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="ProductComponent" Guid="8046caf4-6e90-4002-bc2f-9007e028f5f8" Win64="yes">
<File Id="ProductComponent" Source="UDFDemo.dll" KeyPath="yes" Checksum="yes"/>

<RegistryValue Root="HKCR"
Key
="CLSID\{E8E9F986-97AA-4c22-A3A3-8C67991BD152}\InprocServer32" Value="C:\Windows\system32\UDFDemo.dll" Type="string" Action="write" />

<RegistryValue Root="HKCR"
Key
="CLSID\{E8E9F986-97AA-4c22-A3A3-8C67991BD152}\ProgID" Value="UDFDemo.UDFDemo.1" Type="string" Action="write" />

<RegistryValue Root="HKCR"
Key
="CLSID\{E8E9F986-97AA-4c22-A3A3-8C67991BD152}\Programmable" Type="string" Value="" />

<RegistryValue Root="HKCR"
Key
="CLSID\{E8E9F986-97AA-4c22-A3A3-8C67991BD152}\VersionIndependentProgID" Value="UDFDemo.UDFDemo" Type="string" Action="write" />


<!--<RegistryValue Root="HKCR"
Key="CLSID\{E8E9F986-97AA-4c22-A3A3-8C67991BD152}\Programmable\InprocServer32"
Name="FriendlyName" Value="C:\Windows\system32\UDFDemo.dll" Type="string" Action="write" />
-->
</Component>
</Directory>
</Directory>
</Directory>

<Feature Id="ProductFeature" Title="UDFMSI" Level="1">
<!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. -->
<ComponentRef Id="ProductComponent" />

<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
<ComponentGroupRef Id="Product.Generated" />
</Feature>
</Product>
</Wix>

 

江苏瑞步科技的主页 江苏瑞步科技 | 初学一级 | 园豆:60
提问于:2010-02-27 21:04
< >
分享
所有回答(1)
0

不应该引用using Microsoft.Win32。

风影极光 | 园豆:1573 (小虾三级) | 2010-02-27 23:55
是的,原来操作注册表添加的,忘记删掉了。
支持(0) 反对(0) 江苏瑞步科技 | 园豆:60 (初学一级) | 2010-02-28 00:29
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册