enterprise library configuration tool and configuration sources

Topics: General discussion
Sep 13, 2011 at 9:59 PM

My problem is that we have a few windows and wcf services which all use the same database and the same settings for the enterprise library, and we want a single point where these can be modified, especially since we are supporting 7 environments( development, qc and production). So I found out that I can specify a configuration source from the enterprise library to point to a file on the disk and I can save all config sections there.

My question is if there is a way to save custom configuration sections there ( I think I can, at least according to this link: http://thejoyofcode.com/Using_Enterprise_Library_to_break_up_your_configuration_files.aspx ) but I don't know if I can edit them using the enterprise library configuration tool. Is there a simple way to edit them using the tool, or do I have to extend the tool, or it just can't be done?

Sep 14, 2011 at 3:15 AM

Hi,

I don't think you can modify the behavior of the tool; it comes packaged with EntLib already as an .exe file. Sorry to be the bearer of bad news :-(

Sep 14, 2011 at 4:52 AM

Hi,

Yes you can save your configuration sections on a separate config file by using the File Configuration Source (kindly refer here for more details). Regarding with your second question, yes you can edit it with the configuration tool assuming that you created the same config using the config tool.

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us

Sep 14, 2011 at 2:25 PM

Actually I was referring to custom configuration sections, not the configuration sections defined in the Microsoft.EnterpriseLibrary namespace. If I create a configuration section, of a custom type, can I edit it in the configuration tool? Can I extend the configuration tool so I can edit that custom type?

Sep 15, 2011 at 4:12 AM

Apologies for the confusion. It seems like its more of creating a custom application block since you have the need to edit it through the config tool. You don't need to extend the config tool but rather you need to create the proper assemblies to be able to integrate your custom sections to it. The Extensibility Hands On Labs will guide you on that. Hope this helps :).

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us

Sep 16, 2011 at 9:29 PM

Thanks a lot for the help, that was exactly what I needed. The problem is that even after I created my custom block I can not see it in the configuration tool. I copied the dll's in the same folder as the EntLibConfig.exe and nothing. I even compiled the example from the labs and copied that too in the same folder and still nothing, I can not see it when I start the config tool and go to add blocks.

Sep 19, 2011 at 1:15 PM

You also need to configure the ConfigurationSet (first instruction from the Exercise #4: Configuration Tool Integration):

In the <lab root>\Reference Assemblies\Entlib 5, there is a Windows PowerShell™ script,CreateConfigurationSet.ps1. Open this folder in Windows Explorer and run this script. This will addregistry entries so that Visual Studio will find a new place to look for the Entlib configuration tool.If you've never run PowerShell before, it comes out of the box with script execution turned off. If you getan error when attempting to run the script, open up a PowerShell window as an administrator. At thecommand prompt, type "set‐executionpolicy remotesigned". Choose Yes if prompted. You can thenclose the PowerShell window and run the CreateConfigurationSet.ps1 script again

Hope this help :)

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us

Sep 21, 2011 at 8:01 PM

I did the 4 steps in the lab 4, compiled again and moved the dll's to the EntLibConfig.exe folder. I still can't see my application block in the list when I go to Blocks menu.

Sep 22, 2011 at 5:16 AM

Are you opening the config inside the Visual Studio?

 Configuration Editor

If it still doesn't show, then you might double check the steps from the Exercise and see if you have applied it in your solution.

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us

Sep 22, 2011 at 2:59 PM

Yes, I am opening it in Visual studio, and I have no other block available except those that came with Enterprise Library. Anyhow, I think this should work outside of Visual studio as well, how else would you deploy a custom application block ? And I double checked the steps, and also even if I made a mistake the dll's that I generated based on the code that came with the exercise are still not working, I can't see the Greeting application block either.

Sep 23, 2011 at 3:53 AM

Can you check if HKEY_CURRENT_USER\Software\Microsoft\Practices\EnterpriseLibraryV5\ConfigurationEditor\EntlibExtensibilityLabs exists on your registry?

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us

 

Sep 23, 2011 at 2:38 PM

It exists and it points to the Reference Assemblies folder that came with the labs.

Sep 26, 2011 at 11:06 AM
Edited Sep 26, 2011 at 11:13 AM

I'm not sure if you missed something on your side but here are the steps I did to make it work.

1) Download the Extensibility Hands On Labs found here.
2) Compile and Run the GreetingsBlock.sln found in Enterprise_Library_Extensibility_Hands-On_Labs\GreetingsBlock\Ex04\End.
3) Run the powershell script "CreateConfigurationSet.ps1" from Enterprise_Library_Extensibility_Hands-On_Labs\Reference Assemblies\Entlib 5. If you encountered an error, run the Powershell prompt as Administrator and enter this command:
     set‐executionpolicy RemoteSigned then try to rerun the script.
4) Close Visual Studio then open the GreetingsBlock.sln
5) Right click the app.config under GreetingsClient project then choose Edit Enterprise Library V5 Configuration. You should be able to see the Greetings Block.

Let us know if you still have the issue.

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us