views:

129

answers:

7

I have a class library file that is not is not getting picked up when I add it to the reference and bin folder.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace SecuritySettings
{
     public class Security
     {
          ...
          public Security()
          {...}    
     }
}

Is there something that I am not doing behind the scene or something else?

A: 

Have you tried to call it by with full name space, i.e. SecuritySettings.Security ?

Also there is a misspelling in your code there. Check namespace

dove
A: 

Have you doen a build on the solution? I have found that sometimes you need to build the solution before it picks everything up.

Also, you will need to add a using statement at the top of the class library or the code-behind which uses the security class.

using SecuritySettings;
aquillin
+1  A: 

Check the project setting, look at the Root namespace settings, that may be confusing you.

eschneider
How many times has this caused me a headache :o
Pondidum
yeah, not sure why you would use this. Maybe the Company name? But then why does it default to project name?
eschneider
+1  A: 

Try checking your .csproj fie (open in notepad) for the reference and ensure the path is correct.

Also, instead of copying the file directly into the bin folder (which is genrally bad as this is the folder Visual Studio deploy built dll's into), create a new folder in your project (for example a folder called 'libs') and reference it from there.

Jaimal Chohan
A: 

This may have much to do with the project type you're using.

If you're using a web application type project, in which everything in your project is compiled to a .dll, then the steps you took -- add a reference to the project, compile -- should work.

If, however, you are using a web site type project -- a holdover from the early ASP.NET days that is very loosely compiled, make sure you have a reference to the project in your web.config. You do so as follows:

<compilation debug="false">
  <assemblies>
    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="MySecuritySettingsAssemblyName"/>
  </assemblies>
</compilation>
Randolpho
A: 

It might be a long shot,

Check out that the Build-Action of the file is Compile. (look at properties when you select the file on the solution explorer. Hope that help

Ariel

ArielBH
A: 

Start with a clean of your solution Check the Path of your reference Check the "Reference Paths" of your project properties. This one always get priority over the the previous path.

also when working with any pre-VS2005 version might require a restart of your VS.

Aussie Ausbourne