Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

excel - .NET app.config question

I have created an Excel 2003 add-in that uses the CLR 2.0 and this add-in is to be installed in hundreds of machines at my customer's site. The issue is that some of the machines where the add-in is installed have .NET 1.1 and .NET 2.0 running side by side, and the plugin throws an error when it's trying to load.

The solution I have come across that works is to create an excel.exe.config file in the same folder where excel.exe is that sets the supportedRuntime version to v2.0.50727.

Because this solution does not scale well in my case (since the add-in is to be used in hundreds of machines where the users might not even have access to create a config file), I was wondering if I could add the same supportedRuntime parameter in my plugin app.config file and it would work.

If this will not work, do you guys know of anything else I could try?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

What is the error message that you receive?

The problem that you describe should not occur with Office 2007. However, it is a known problem for so-called Shared Add-ins (.NET add-ins based on the Extensibility.IDTExtensibility2 interface using COM interoperability) in Office 2003.

Microsoft has a released a patch, which should be installed for every user using the add-in. You can obtain the patch here:

http://support.microsoft.com/kb/908002

The solution using the config file is a non-standard solution but should also fix the problem as stated in the following article:

http://nielsvanvliet.com/excel.html#Patch

If want to deploy your add-in using an MSI installer you should check the Shared Add-in Support Update for the Microsoft .NET Framework 2.0 (KB908002) as a pre-requisite in the properties of the setup project. Please note that this fix can only be installed for the current user, i.e. an ALLUSERS setup should be disabled.

UPDATE: The installation with VS 2008 is a little more complicated. See here:

Can a .NET Word 2003 add-in be installed outside of the GAC?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...