I have two projects 'HOD', and 'Controllers'. Controllers is a class library with a namespace of 'Controllers'. In the code file for HOD I am trying to reference the Controllers namespace by 'using Controllers'. I added a reference in the HOD project to Controllers and it does show up in VS2008 under the references folder.
When I build out the project I get no errors, but when I go to view the page I receive the error 'The type or namespace name 'Controllers' could not be found (are you missing a using directive or an assembly reference?)'.
Controllers.cs ( class library, Controllers project )
using System;
using System.Collections.Generic;
using System.Text;
namespace Controllers
{
public class Controller { }
}
index.aspx.cs ( HOD project )
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Controllers;
public partial class HOD : Page
{
string sop() { return "sop"; }
protected void Page_Load(object sender, EventArgs e)
{
blahmsg.Text = sop();
}
}
The project is located on our webserver, and the Controllers.dll is located in the same bin folder as HOD.dll. Thanks in advance for your help!
edit: .sln contents
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "T:", "T:\", "{1D5F28B3-E6A0-4CF8-B7A3-43121225C73E}"
ProjectSection(WebsiteProperties) = preProject
TargetFramework = "2.0"
Debug.AspNetCompiler.VirtualPath = "/T:"
Debug.AspNetCompiler.PhysicalPath = "T:\"
Debug.AspNetCompiler.TargetPath = "E:\DEV\webdev\webdev\PrecompiledWeb\T:\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/T:"
Release.AspNetCompiler.PhysicalPath = "T:\"
Release.AspNetCompiler.TargetPath = "E:\DEV\webdev\webdev\PrecompiledWeb\T:\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "53327"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HOD", "Y:\HOD\HOD.csproj", "{5F523FB7-B902-4E6E-BAA9-C2EB37D69EC7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controllers", "Y:\HOD\Controllers\Controllers.csproj", "{E6A16990-5FC6-4FE3-8DAB-CD2FEC8CF4FF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C8A12BBE-4483-4560-97A4-795F2E57D667}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8A12BBE-4483-4560-97A4-795F2E57D667}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8A12BBE-4483-4560-97A4-795F2E57D667}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{C8A12BBE-4483-4560-97A4-795F2E57D667}.Release|Any CPU.Build.0 = Debug|Any CPU
{A81C381B-1E12-49B0-8BC0-8532EF9F216F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A81C381B-1E12-49B0-8BC0-8532EF9F216F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A81C381B-1E12-49B0-8BC0-8532EF9F216F}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{A81C381B-1E12-49B0-8BC0-8532EF9F216F}.Release|Any CPU.Build.0 = Debug|Any CPU
{BD46969E-9D1C-419A-A82C-388E35BF7C13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD46969E-9D1C-419A-A82C-388E35BF7C13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD46969E-9D1C-419A-A82C-388E35BF7C13}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{BD46969E-9D1C-419A-A82C-388E35BF7C13}.Release|Any CPU.Build.0 = Debug|Any CPU
{1D5F28B3-E6A0-4CF8-B7A3-43121225C73E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D5F28B3-E6A0-4CF8-B7A3-43121225C73E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D5F28B3-E6A0-4CF8-B7A3-43121225C73E}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{1D5F28B3-E6A0-4CF8-B7A3-43121225C73E}.Release|Any CPU.Build.0 = Debug|Any CPU
{5F523FB7-B902-4E6E-BAA9-C2EB37D69EC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5F523FB7-B902-4E6E-BAA9-C2EB37D69EC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5F523FB7-B902-4E6E-BAA9-C2EB37D69EC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F523FB7-B902-4E6E-BAA9-C2EB37D69EC7}.Release|Any CPU.Build.0 = Release|Any CPU
{E6A16990-5FC6-4FE3-8DAB-CD2FEC8CF4FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6A16990-5FC6-4FE3-8DAB-CD2FEC8CF4FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6A16990-5FC6-4FE3-8DAB-CD2FEC8CF4FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6A16990-5FC6-4FE3-8DAB-CD2FEC8CF4FF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Compiler output
------ Rebuild All started: Project: Controllers, Configuration: Debug Any CPU ------ C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Controllers.dll /target:library Class1.cs Properties\AssemblyInfo.cs
Compile complete -- 0 errors, 0 warnings Controllers -> Y:\HOD2\Controllers\bin\Debug\Controllers.dll ------ Rebuild All started: Project: HOD, Configuration: Debug Any CPU ------ C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:Y:\HOD2\Controllers\bin\Debug\Controllers.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.EnterpriseServices.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Extensions.Design.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Extensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.Mobile.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /optimize- /out:obj\Debug\HOD.dll /target:library index.aspx.cs index.aspx.designer.cs Properties\AssemblyInfo.cs
Compile complete -- 0 errors, 0 warnings HOD -> Y:\HOD2\bin\HOD.dll ========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========