|
|
|
date: Wed, 6 Aug 2008 09:21:12 -0700,
group: microsoft.public.dotnet.framework
back
RE: Configured Assemblies - get and set
Dear JH,
As I understand, you add some assembly configuration information into
machine.config file, and want to copy these configuration information to
other machines.
The assembly configuration information are store in the "assemblyBinding"
section under the "runtime" section. We can use
ConfigurationManager.OpenMachineConfiguration() method to open the machine
configuration file on the current machine, and read or write configuration
information with the Configuration object.
For example, we can do something like this:
========Sample Code===================
Configuration MachineConfig =
ConfigurationManager.OpenMachineConfiguration();
//The "Configured Assemblies" information are stored in the
runtime section
ConfigurationSection runtimeSection =
MachineConfig.Sections["runtime"]; //case sensitive
string content = runtimeSection.SectionInformation.GetRawXml();
Console.WriteLine(content);
//do something with the configuration section
runtimeSection.SectionInformation.SetRawXml(content);
MachineConfig.Save();
======================================
For more information about this, you can refer to:
ConfigurationManager.OpenMachineConfiguration() method
http://msdn.microsoft.com/en-us/library/system.configuration.configurationma
nager.openmachineconfiguration.aspx
However, for redirecting assembly versions on target machines, I would
recommend you create a publisher policy file instead of changing the
machine.config file programmatically.
For how to create a publisher policy file, you can refer to this document:
How to: Create a Publisher Policy
http://msdn.microsoft.com/en-us/library/dz32563a.aspx
If you are unclear about any of this, please feel free to let me know.
Have a nice day!
Sincerely,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team
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:
msdnmg@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
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://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
date: Thu, 07 Aug 2008 10:19:43 GMT
author: (Zhi-Xin Ye [MSFT])
Re: Configured Assemblies - get and set
Dear JH,
On a 64-bit machine, the Framework directory contains the assemblies that
are specific to the WoW64(32-bit emulation on 64-bit platforms), while the
Framework64 directory contains assemblies that are specific to the 64bit
platform. Assemblies which are platform agnostic are available in either or
both the directories.
Which machine.config file that the
ConfigurationManager.OpenMachineConfiguration() method opens is based on
the target platform of your application.
If the target platform property of your application is set to "Any
CPU"(this is by default) or "x64", when running on a 64-bit machine, the
ConfigurationManager.OpenMachineConfiguration() method will open the
machine.config file under the Framework64 directory.
If the target platform property of your application is set to "x86", when
running on a 64-bit machine, the
ConfigurationManager.OpenMachineConfiguration() method will open the
machine.config file under the Framework directory.
So you can create two application, one specific to x86 target platform, the
other specific to "Any CPU"(or x64) target platform, then you should be
able to access both machine.config files.
Sincerely,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team
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:
msdnmg@microsoft.com.
==================================================
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.
date: Tue, 12 Aug 2008 06:48:17 GMT
author: (Zhi-Xin Ye [MSFT])
|
|