.NET AddIn - Version 1.1 and 2

K

KeithM

Hi,
I have an office add-in written in C sharp and compiled against .NET v1.1

If I install this addin to a machine running .NET frameworks 1.1 and 2.0,
which framework will my add in run against?

http://msdn.microsoft.com/en-us/library/ms994381.aspx?ppud=4 implies that it
will run agianst the latest?

Is there any code I can put in my addin to test and find out which framework
version the code is running against?

This is important because my code is part of a secure system and if it is
now running against .NET 2.0 (installed by another app) then we may have to
redo a large part of our testing.

Thanks.
 
J

Jialiang Ge [MSFT]

Good morning KeithM, nice to see you again.

For Office Add-in components that run in a computer installed with both .NET
runtime 1.1 and 2.0, the addins load with 2.0 unless the process is
configured to run against 1.1. This point is documented at
http://msdn.microsoft.com/en-us/library/ms994381.aspx?ppud=4 as you may have
already noticed. In order to find out which framework version the code is
running against at runtime, may I suggest the following two solutions:

Solution 1. Check the runtime version in code.

The function:
System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion() can
tell us the runtime version.
http://msdn.microsoft.com/en-us/lib...ices.runtimeenvironment.getsystemversion.aspx
So we can call it in the Addin solution and see if the runtime meets our
requirement.

Solution 2. Check the runtime version with the tool: Process Explorer.

Process explorer can be downloaded at
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx. We can use
the tool to view the DLLs loaded by a certain process, say Office process.
Because .NET 1.1 runtime loads 1.1 version of mscrowks.dll, and .NET 2.0
runtime's mscorwks.dll is 2.0, we can determine the current runtime
according to this version number. The detailed step list is:
1. start the Office application that loads our add-in
2. start process explorer
3. In the View menu of process explorer, select Lower Pane View -> DLLs.
4. In the Process list of process explorer, find the office process and view
its DLL list in the low pane.
5. find mscorwks.dll and look at its version.

Please try the above two solutions and let me know whether they are helpful
to you.

In addition, I'd like to share some other relevant materials with you that
might be useful:

1. How to configure Office application to run against .NET 1.1 runtime.
We can add a config file to the Office exe. Take winword as an example:
create a file named 'winword.exe.config' with the following content, and
place the file together with winword.exe.

<configuration>
<startup>
<supportedRuntime version="v1.1.4322" />
<supportedRuntime version="v1.0.3705" />
</startup>
</configuration>
For more readings, please refer to the article:
http://msdn.microsoft.com/en-us/library/ms994410.aspx

2. What is the potential problems if we configure Office application to run
against .NET 1.1 runtime?
The potential problem is that, all the existing Office add-ins that rely on
..NET 2.0 runtime are very likely to crash (fail to be loaded) after we add
this config file.

By the way, I will not be available in the next three days due to a
training. My colleague will continue supporting you if you have any
follow-up questions.

Have a very nice day!

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top