Enterprise Library 6: Installation and VS2012 Configuration

This post will go through how to install Enterprise Library 6 binaries and configure Visual Studio 2012.

The easiest way to install Enterprise Library 6 is to use NuGet (see Installing NuGet for information on installing NuGet) .  Right-click on Add References and select “Manage NuGet Packages…”.  Then search for entlib6 and install the packages you wish.

However, in some situations you may wish to use alternative approaches.  For example download the binaries in order to explicitly manage versions or have a standard library location for developers etc.

Download and Install Enterprise Library

The first step is to download the binaries.  You can download the binaries EnterpriseLibrary6-binaries.exe from from http://www.microsoft.com/en-us/download/details.aspx?id=38789.

Next Run EnterpriseLibrary6-binaries.exe:

EntLib1

Select Yes (if you agree!).  Then browse for the folder to install the binaries into.  This can be any location you wish.  For this example I will use C:\EntLib\EntLib6.  This is one difference from previous releases.  In previous releases an installer would actually install Enterprise Library into Windows but with EntLib6 the files are extracted to the target folder.  The files will be unpacked and when done you should get a success message:

EntLib2

If we open up a command shell and browse to the location of unpacked files we will see the following:

EntLib3

If you’ve used Enterprise Library before you would probably notice that the actual assemblies have not been installed.  A quick look at the ReadMe file will let you know that you need to download the binaries using the supplied script, install-packages.ps1.

Run the script by typing: powershell -File .\install-packages.ps1

EntLib4

EntLib5

Type Y and hit <ENTER>.  You should receive message that the packages were successfully installed:

EntLib6

All assemblies are now in the current directory (e.g. C:\EntLib\EntLib6):

EntLib7

That completes the installation.

Assemblies can now be added as file references but how can we get good integration with Visual Studio 2012?

Visual 2012 Configuration

NuGet

Along with downloading the assemblies into the target folder the previous steps also installed the NuGet packages locally.  What can we do if we don’t want to be dependent on an internet connection to add Enterprise Library to our projects?  One way is to create a local package source for Enterprise Library.

To do this open up Package Manager Settings (TOOLS->Library Package Manager-> Package Manager Settings):

EntLib8

Next go to Package Manager->Package Sources and add a new entry for EntLib6.  Click Add, Enter a Name and a Source (where the NuGet packages were installed which in this example is C:\EntLib\EntLib6\.nuget\packages) and click Update:

EntLib9

Then click OK.

Now when opening Manage NuGet Packages

EntLib10

we can select the local EntLib6 Packages as the source of all Enterprise Library 6.  (“local” could also be on a shared network folder if desired.)

EntLib11

Using the above approach we can still use NuGet to manage our local Enterprise Library binaries.

Add Reference Configuration

But what if we don’t want to mess around with NuGet and we just want to have the Enterprise Library assemblies appear in the list of assemblies in Add Reference (old school!)?  To do this we can use the technique described in How to: Add or Remove References By Using the Add Reference Dialog Box.

The following is for Visual Studio 2012 64-bit version. As a privileged user, open up the Registry Editor (regedit) and browse to the appropriate .NET Version Key:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\<version>\AssemblyFoldersEx

On my machine this is:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx

Add a New Key for EntLib6 and set the default value to the location where Enterprise Library 6 was installed (C:\EntLib\EntLib6\ in this example):

EntLib12

Now when adding a reference in VS2012 we should Enterprise Library 6 assemblies in the Extension list:

EntLib13

Conclusion

Unfortunately, this post turned out to be very long.  The good news is that we’ve seen how to install Enterprise Library 6 and a few methods of configuring Visual Studio 2012 to easily use the blocks.

Also, note that we haven’t discussed installing Enterprise Library in the GAC.  If you wish to install in the GAC then you would have to manually install the desired assemblies in to the GAC (e.g. gacutil or drag the assemblies into GAC).

About these ads
This entry was posted in .NET, Enterprise Library and tagged , . Bookmark the permalink.

6 Responses to Enterprise Library 6: Installation and VS2012 Configuration

  1. Andrew says:

    the key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework does not exist in my Windows 7 installation.

  2. Achutha krishnan says:

    Hi, when I try to extract the binaries and run through power shell, I’m unable to find the below path/file –> C:\EntLib\EntLib6\.nuget\packages. The “packages” folder/file does not exist. Am I doing something wrong, please let me know.

  3. Konark says:

    i follow your guide but i have encountered the problem after install-pacakage.ps1 run
    “executable is not supported for the os platform”
    i just install new nuget.exe from the(nuget.org/nuget.exe) because “Nuget.exe 2.2 crashes”

    and solved the problem

  4. As an aside, although a notable one; Many developers across a large number of sites have had difficulty overcoming restrictions on running “unsigned” powershell scripts on their hosts. A number of sites recommend using “Set-ExecutionPolicy” as a work-around, but on Windows 7 workstations, even doing so as an administrative user, running Ps as an Administrator, they’re still getting bounced.

    Hours can be lost trying different routes and ways to “climb a mountain”, but often the easiest way to get where you want to be is to just bypass the blockage entirely.

    Option 1: “powershell -ExecutionPolicy ByPass -File somescript.ps1″ Is far better than lowering ExecutionPolicy system wide, and then hoping you remember to reset it to Restricted later (which often doesn’t happen).

    Option 2: Open the ps1 file, copy->paste it into a Ps console running under elevated permissions, on an Administrator Login.

    Remember, Windows doesn’t have any problem with PowerShell as a tool whatsoever, but because of its power and potential for misuse, the OS wants to make darned sure that unknown scripts get eyeballed before they’re allowed to run.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s