Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Wed, 6 Aug 2008 09:21:12 -0700,    group: microsoft.public.dotnet.framework        back       


Configured Assemblies - get and set   
(I posted this on framework.setup group but got no reply. So I'm posting
it in this group again. Please let me know if this is not the right forum to 
post this
question. Thanks)

So we'd like to copy the "Configured Assemblies" settings and deploy the
same list (configure the assemblies the same way) on other machines.
Is there a Windows or .NET API to get and set this information?

We tried to read the info from this file:
"%windir%\Microsoft.NET\Framework\v#.#.####\CONFIG\machine.config"

There are two issues:
1. it's probably not the documented/supported way for this purpose
2. it doesn't always work on 64bit machines. On 64bit machines, the file
is sometimes in Framework, sometimes in Framework64. Usually two
copies of the machine.config file exist. Sometimes one is modified
(when configured assemblies changes are done in mscorecfg) some
times the other file is modified. We haven't figured out when to
use which file.
date: Wed, 6 Aug 2008 09:21:12 -0700   author:   JH am

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   
Thanks Zhi-Xin, for the reply.

On a 64bit machine, is it supposed to give me different
settings for the 32 version and the 64 version of machine.config?
What I mean is that there is a machine.config under Framework
directory, another machine.config under Framework64 directory.

> 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.
date: Fri, 8 Aug 2008 13:44:27 -0700   author:   JH am

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])

Re: Configured Assemblies - get and set   
Dear JH,

Does my last reply make sense to you? If you need further help, please feel 
free to let me know, I will be happy to be of assistance.

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.

This posting is provided "AS IS" with no warranties, and confers no rights.
date: Mon, 18 Aug 2008 05:30:14 GMT   author:   (Zhi-Xin Ye [MSFT])

Re: Configured Assemblies - get and set   
Sorry for the late reply. We got carried away by some other issues.
We'll be testing this in the next few days and report back.

"Zhi-Xin Ye [MSFT]"  wrote in message 
news:Ncr1QWPAJHA.5808@TK2MSFTNGHUB02.phx.gbl...
> Dear JH,
>
> Does my last reply make sense to you? If you need further help, please 
> feel
> free to let me know, I will be happy to be of assistance.
>
> 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.
>
> This posting is provided "AS IS" with no warranties, and confers no 
> rights.
>
>
date: Tue, 26 Aug 2008 09:51:10 -0700   author:   JH am

Re: Configured Assemblies - get and set   
Dear JH,

Thanks for your feedback, I'm looking forward to hearing from you.

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.

This posting is provided "AS IS" with no warranties, and confers no rights.
date: Wed, 27 Aug 2008 02:49:45 GMT   author:   (Zhi-Xin Ye [MSFT])

Re: Configured Assemblies - get and set   
Hi Zhi-Xin, a colleague of mine tried it and it worked.
Thanks for your help!

"Zhi-Xin Ye [MSFT]"  wrote in message
news:D5%23%23X%23%23BJHA.3988@TK2MSFTNGHUB02.phx.gbl...
> Dear JH,
>
> Thanks for your feedback, I'm looking forward to hearing from you.
>
> 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.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
date: Thu, 28 Aug 2008 15:06:28 -0700   author:   JH am

Re: Configured Assemblies - get and set   
Dear JH,

I'm glad that my suggestion helped.

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.

This posting is provided "AS IS" with no warranties, and confers no rights.
date: Fri, 29 Aug 2008 05:28:10 GMT   author:   (Zhi-Xin Ye [MSFT])

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us