Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How do i get my dll reference to show up in my references folder.

Posted on 2011-09-11
8
417 Views
Last Modified: 2012-05-12
I've got a class, that is part of a project, written in ASP .NET 3.5. C#. I have tried to add a reference to the Microsoft.Practices.EnterpriseLibrary.Common dll to the references folder of my the project that contains this class, but I can't find it in the list of references. However I am able to add a reference to it with a using statement, within the class. I am also able to add the reference to the main project, in its bin folder, which is why, i'm guessing, that when i try to add the reference to it, in my other project, I can't find it in the list. When I try to make a call to an attribute / property of the dll, i get an error (at compile time) telling me that the namespace could not be found, which i don't understand because, as i mentioned, it does allow me to use a using clause to pull in the library. I've added the class code. I'm not sure what I'm doing wrong or why i'm having compile time errors...
using System;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using StudyTimeTracker.Enterprise.Data;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration; //<---HERE, I'M ABLE TO ADD TO MY CLASS WITH THIS USING

namespace StudyTimeTracker.Enterprise.ExceptionHandling
{
    /// <summary>
    /// A custom exception handler that logs the key information from an exception to the Instrumentation Database.
    /// </summary>

    [ConfigurationElementType(typeof(CustomHandlerData))] //<---THIS IS WHERE I'M HAVING COMPILE TIME ERRORS

    public class SqlCustomExceptionHandler : IExceptionHandler
    {
        /// <summary>
        /// Required but not implemented.
        /// </summary>
        /// <param name="collection"></param>
        public SqlCustomExceptionHandler(NameValueCollection collection)
        {
        }

        #region IExceptionHandler Members
        /// <summary>
        /// Implements IExceptionHandler HandleException method
        /// </summary>
        /// <param name="exception">The exception that should be logged to the database</param>
        /// <param name="handlingInstanceId">The instance id</param>
        /// <returns>returns the exception that was handled</returns>
        public Exception HandleException(Exception exception, Guid handlingInstanceId)
        {
            try
            {
                WriteException(exception);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            return exception;
        }

        #endregion

        #region Private Members
        private void WriteException(Exception exception)
        {
            STTDatabase db = new STTDatabase("Instrumentation");
            SqlCommand command = new SqlCommand();
            command.CommandType = CommandType.Text;
            command.Parameters.Add(new SqlParameter("@ExceptionTypeID", GetExceptionTypeId(exception)));
            command.Parameters.Add(new SqlParameter("@ExceptionSource", exception.Source != null ? exception.Source : String.Empty));
            command.Parameters.Add(new SqlParameter("@ExceptionMessage", exception.Message != null ? exception.Message : String.Empty));
            command.Parameters.Add(new SqlParameter("@ExceptionStackTrace", exception.StackTrace != null ? exception.StackTrace : String.Empty));
            command.Parameters.Add(new SqlParameter("@ExceptionDetail", exception.ToString()));
            command.Parameters.Add(new SqlParameter("@ExceptionOwner", Environment.MachineName));
            command.CommandText = @"
                INSERT INTO Exception_Log (Exception_Type_Id, Exception_DateTime, Exception_Source, Exception_Message, Exception_StackTrace, Exception_Detail, Exception_Owner)
                VALUES(@ExceptionTypeID, GetDate(), @ExceptionSource, @ExceptionMessage, @ExceptionStackTrace, @ExceptionDetail, @ExceptionOwner)
            ";
            db.ExecuteNonQuery(command);
        }

        private int GetExceptionTypeId(Exception exception)
        {
            int exceptionTypeId = 0;
            if (exception.Data["ExceptionTypeId"] != null)
            {
                exceptionTypeId = Convert.ToInt32(exception.Data["ExceptionTypeId"]);
            }
            return exceptionTypeId;
        }
        #endregion
    }
}

Open in new window

0
Comment
Question by:mikesExpertExchange
  • 5
  • 3
8 Comments
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 36521254
Add reference to the DLL. Right click the project -> Add reference -> .NET tab -> Select Microsoft.... dll or Browse to the DLL where you have your DLL to be referred.
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36522252
thank you, don't know why that wasn't obvious. one other question, where do i find the PublicKeyToken for dll?
0
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 36522295
Assuming the DLL is in GAC. Go to assembly folder and Right click the DLL -> Properties. You can see the PublicKeyToken.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36522451
i've right click on it in both, the VS project folder, and Go the folder where the file lives in windows explorer and have not seen or found the jazz am I looking in the wrong places? how do I get to the assembly folder?
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36522459
in my last post "Go"="in"
0
 
LVL 16

Accepted Solution

by:
Easwaran Paramasivam earned 500 total points
ID: 36522509
in run prompt type assembly. In my mahine it is C:\Windows\assembly
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36522920
ok i went there and unfortunately do not see my assembly there. is there somewhere else it would be? some where else i could look? if it's not in the GAC where else might it be?
0
 
LVL 1

Author Closing Comment

by:mikesExpertExchange
ID: 36524481
thank you
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question