Microsoft.Practices.EnterpriseLibrary.Logging引发Release中的错误,但不会引发Debug

时间:2015-12-11 03:34:16

标签: c# visual-studio

我有一个ClickOnce项目,我刚刚从VS2010更新到VS2015,其中引用了上面的内容(例如,使用Microsoft.Practices.EnterpriseLibrary.Logging;)。

当我在Debug中运行项目时,它不会标记该引用或它的用途。

当我交换到Release时,Using语句被标记为“错误CS0234名称空间'Microsoft'中不存在类型或命名空间名称'Practices'(您是否缺少程序集引用?)”

我尝试从NuGet安装Enteprise Logging库,但它没有说它不针对.Net 4(在更新VS版本之间我没有更改目标框架)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Logging;
using System.Diagnostics;

namespace BlahBalh.BudgetReporting.Common
{
    /// <summary>
    /// Handles the writing of information to the log (Event Viewer).
    /// Uses the Microsoft Best Practices Library, see App.config for loggin options.
    /// </summary>
    public class Log
    {
        /// <summary>
        /// Constructor - private as this is a static class
        /// </summary>
        private Log() { }

        /// <summary>
        /// Add the information to the log.
        /// Use for general information messages.
        /// </summary>
        /// <param name="Title">Message Heading</param>
        /// <param name="Message">Detailed information.</param>
        public static void LogInformation(string Title, string Message)
        {
            LogEntry logEntry = new LogEntry();
            logEntry.Title = Title;
            logEntry.Message = Message;
            logEntry.Priority = 0;
            logEntry.EventId = 1;
            logEntry.Severity = TraceEventType.Information;
            logEntry.Categories.Add("General");
            WriteEntry(logEntry);
        }

等...

我也试过找到汇编参考区但在VS2015中看不到它(它被NuGet取代了吗?)

任何指针都非常感激。

0 个答案:

没有答案