Does Enterprise Library 6 work with Visual Studio 2013 and/or 2015?

邮差的信 提交于 2019-11-27 20:13:00

It does. You may add Enterprise Library 6 into your project via Nuget Here is the sample application.

using System;
using System.Diagnostics;
using Microsoft.Practices.EnterpriseLibrary.Logging;
using Microsoft.Practices.EnterpriseLibrary.Logging.Formatters;
using Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners;

namespace Practice.Logging
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            LoggingConfiguration loggingConfiguration = BuildProgrammaticConfig();
            var defaultWriter = new LogWriter(loggingConfiguration);

            // Check if logging is enabled before creating log entries.
            if (defaultWriter.IsLoggingEnabled())
            {
                defaultWriter.Write("Log entry created using the simplest overload.");
                defaultWriter.Write("Log entry with a single category.", "General");
                defaultWriter.Write("Log entry with a category, priority, and event ID.", "General", 6, 9001);
                defaultWriter.Write("Log entry with a category, priority, event ID, " + "and severity.", "General", 5, 9002, TraceEventType.Warning);
                defaultWriter.Write("Log entry with a category, priority, event ID, " + "severity, and title.", "General", 8, 9003, TraceEventType.Warning, "Logging Block Examples");
            }
            else
            {
                Console.WriteLine("Logging is disabled in the configuration.");
            }
        }

        private static LoggingConfiguration BuildProgrammaticConfig()
        {
            // Formatter
            var formatter = new TextFormatter();

            // Trace Listeners
            var eventLog = new EventLog("Application", ".", "StackOverflow #24309323");
            var eventLogTraceListener = new FormattedEventLogTraceListener(eventLog, formatter);

            // Build Configuration
            var config = new LoggingConfiguration();
            config.AddLogSource("General", SourceLevels.All, true)
                  .AddTraceListener(eventLogTraceListener);

            config.IsTracingEnabled = true;
            return config;
        }
    }
}

You may find more details in Logging Application Block

To use Enterprise Library Configuration Console Extension

To install the extension into the Visual Studio 2013 you may follow the workaround steps below.

  • download Microsoft.Practices.EnterpriseLibrary.ConfigConsoleV6.vsix from the link

A VSIX file is a zip file that uses the Open Packaging Convention. You can rename the .VSIX extension to .ZIP and use any zip browser (including the Windows File Explorer) to browse its contents.

  • extract the file into a folder
  • locate the file called extension.vsixmanifest in the folder
  • open the file with notepad.exe
  • locate
<SupportedProducts>
  <VisualStudio Version="11.0">
    <Edition>Ultimate</Edition>
    <Edition>Premium</Edition>
    <Edition>Pro</Edition>
  </VisualStudio>
</SupportedProducts>
  • and replace it with the part below
<SupportedProducts>
  <VisualStudio Version="11.0">
    <Edition>Ultimate</Edition>
    <Edition>Premium</Edition>
    <Edition>Pro</Edition>
  </VisualStudio>
  <VisualStudio Version="12.0"> <!-- VS2013 -->
    <Edition>Ultimate</Edition>
    <Edition>Premium</Edition>
    <Edition>Pro</Edition>
  </VisualStudio>
  <VisualStudio Version="14.0"> <!-- VS2015 -->
    <Edition>Ultimate</Edition>
    <Edition>Premium</Edition>
    <Edition>Pro</Edition>
  </VisualStudio>
</SupportedProducts>

  • save the file and exit
  • compress folder as a ZIP file again
  • rename the extension to VSIX
  • double click on it.

Technically the same as @cilerler suggests, but ready-to-download-and-use solution.

Visual Studio 2013: Microsoft.Practices.EnterpriseLibrary.ConfigConsole.V6.VS2013.vsix (Source) Visual Studio 2015: Microsoft.Practices.EnterpriseLibrary.ConfigConsole.V6.VS2015.vsix (Source)

Yes it does. This link will provide all the neccessary details https://msdn.microsoft.com/en-us/library/dn169621.aspx

Also you can refer below sites for detailed implementations. You can install vsix version or binaries (http://www.microsoft.com/en-us/download/details.aspx?id=38789) to create configs. vsix sometimes does not work so you can modify extension.vsixmanifest as stated in below post.

http://www.gonetdotnet.info/posts/configure-and-use-enterprise-library-5-logging http://www.gonetdotnet.info/posts/how-to-configure-and-use-enterprise-library-5-0-application-blocks-using-nuget-package-manager

The project I have is using Enterprise Library 6.0, while the VSIX seems to target EL 5. While I have not been able to get VSIX to work correctly in Visual Studio 2013 and 2015, I am able to get the Enterprise Library 6 Configuration tool from the binaries provided by Microsoft. Here is a link to the download.

Select EnterpriseLibrary6-binaries.exe. Install it by unzipping the file to a folder. The 64-bit Enterprise Library Configuration tool named EntLibConfig.exe. There is a 32-bit version named EntLibConfig-32.exe as well.

Sundara Prabu

We need these following dlls in the bin folder of the asp.net or console or windows app

•Microsoft.Practices.EnterpriseLibrary.Common.dll
•Microsoft.Practices.EnterpriseLibrary.Configuration.DesignTime.dll
•Microsoft.Practices.EnterpriseLibrary.Configuration.Design.HostAdapterV5.dll
•Microsoft.Practices.EnterpriseLibrary.Configuration.EnvironmentalOverrides.dll

Practically Microsoft.Practices.Unity.dll is optional is what I see for entlib 6

source from entlib 5 msdn

For Visual Studio 2017.

<VisualStudio Version="15.0"> <!-- VS2017 -->
    <Edition>Enterprise</Edition>
    <Edition>Premium</Edition>
    <Edition>Pro</Edition>
</VisualStudio>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!