I am trying to make a Cassini-like server for a particular asp.net web application. The Client is not happy with the Cassini interface, so I am just expanding the Cassini code, adding new features, and providing a fresh look to the UI.
Now the problem I am facing is, all the files from Cassini source use the System.Web.Hosting namespace. Visual Studio throws me an error saying:
The type or namespace name 'Hosting' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
What am I missing here? I have already written
using System.Web.Hosting;
in the first line of the .cs file. I am using .Net FW 3.5 and VS2008.
Any help would be seriously appreciated.
Thanks.
Most likely, your project is targeting the "Client Profile" version of the .NET Framework, which doesn't include the System.Web.Hosting namespace.
You need to change your project to target the full version of the framework, and then add a reference to System.Web. To do this, follow these steps:
Open your project Properties by double-clicking on "Properties" in the Solution Explorer.
From the drop-down box labeled "Target framework," choose ".NET Framework 3.5". Visual Studio will inform you that this requires closing and re-opening your project, so make sure that it is saved first before clicking "Yes".
When your project re-opens, right click on "References" in the Solution Explorer, and select "Add Reference" from the context menu.
Find the item named "System.Web" under the ".NET" tab in the resulting dialog box, and click OK.
You have to add the System.Web reference to the project.
Related
I am trying to work with GeoCoordinate which is meant to be supported by .Net Framework 4.5. I am working on winodws 8 and I have .Net Framework 4.5, but I keep getting The type or namespace name 'Device' does not exist in the namespace 'System' error.
Any solution?
The type or namespace name 'XXX' could not be found...
Always bear in mind, if you get this error there are three possibilities.
You missed the using directive.
You missed the Assembly reference
You have "using directive" as well as "Assembly reference" in place but the current project's target framework version is lower than the referenced assembly target framework version.
Almost all the cases above three steps should solve the problem.
Hope this helps.
Does not have added reference of System.Device dll in your project.
Steps to Add Reference.
1. Right click on the Reference folder on your project.
2. Select Add Reference.
3. Expand Assemblies option.
4. Search System.Device in the serach box at right corner side.
5. After searching, click on checkbox to select and click on ok.
If you are using VS.NET:
Right click on the References folder on your project.
Select Add Reference.
Select the .NET tab (or select the Browse button if it is not a .NET Framework assembly).
Double-click the assembly containing the namespace in the error message.
Press the OK button.
If you are using the command line, use the /r: or /reference: option. For Example:
csc.exe /reference:System.Drawing.dll MyFontDisplayApp.cs
When you recompile, this error will no longer appear.
It is also possible that your project uses x64 libraries and your machine has limited x64 libraries. I think this happened in my case.
Possible Solution: I copied library from x86 folder to bin folder of my project. Then added the new reference(discard the old reference to same library). AND IT WORKED.
Note: Please correct me if I am wrong here.
I've been sent a web site developed using Umbraco 4.7 which I've managed to open in VS 2012 Express for Web. When I build the solution, I get an error message
The type or namespace name 'library' does not exist in the namespace 'Clientname.umbraco' (are you missing an assembly reference?)
I'm new to Umbraco but was told I had everything I needed to build the project. In the Solution Explorer, in the References folder there is a listing for 'umbraco' and when I open the reference in the Object Explorer, 'library' is listed, so I can't understand why it can't be found. When I create a new class, add "using umbraco" at the top, it doesn't show 'library' when using intellisense.
I'd try installing Umbraco, but the only way I could do that is to open NuGet and let it create a new project. As this is a web site that is already live and in an older version of Umbraco, I don't think that's a viable option. There are also lots of macros, master pages and user controls the previous developer has done, which I don't want to recreate if possible.
Project details: .Net 4 application, VS 2012 Express for Web, Umbraco runtime v4.0.30319, Umbraco configuration status: 4.7.0
Thanks,
Adrian
Looks like a clash in the naming of items in your project. The library class is accessed via umbraco.library and you have a namespace called Clientname.umbraco which is where it appears to be looking for the library class.
I have a red line under System.Data saying that "The type or namespace 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)."
Thought I needed 4.5 .Net Framework, but I have another project that can use the namespace, so it is something with this project that I am using.
I have seen other threads similar to mine, such as this, but it isn't directly related to just system.data. It's trying to add a namespace beyond data, so there system.data namespace isn't the problem. Haven't seen any threads only related to just the system.data namespace. Any help would be appreciated.
did you try to add the assembly reference in your project?
right click on your project > add reference then select assemblies tab and finally System.Data and check it, then press ok.
Have you checked to make sure the reference to the System.Data assembly is in your project?
Have you a reference to syste.data under your references folder in solution explorer window? If not add it
check the project configuration :
->Right click on Project
->Select Properties
->Change "Target Framework" from ".Net Framework 4.0 Client Profile" to ".Net Framework 4.0"
->now run the Project.
I should preface this question by stating that I am (potentially) inheriting a project that is somewhere around 85% complete. After witnessing successful execution, the full solution was transferred to my machine where I have been struggling to get it running again.
Having made no changes prior, the IDE gives me the following error message:
The type or namespace name 'Infrastructure' does not exist in the namespace 'MyProject' (are you missing an assembly reference?)
This is in spite of clearly seeing the assembly referenced beneath the reference node. I've attempted unattaching, rebuilding, and reattaching the offending assemblies to no avail.
I have explored a variety of options as suggested by other users for similar issues without finding a solution.
What are some potential causes of this and what solutions can I explore?
To fix this problem add in a USING line in the source file.
Your IDE is probably not set Target Framework:
To change the targeted .NET Framework version in an existing project
Open the project you want to change.
In the Solution Explorer toolbar, choose the Properties button.
You can also select the project node in Solution Explorer, open the
context menu (by right-clicking the node), and select Properties.
You should see the settings on the Application tab. If you do not,
select it.
In the Target Framework dropdown list, choose the .NET Framework
version that you want. Then click the OK button.
The project unloads and then reloads. It now targets the framework version that you just selected.
I'm working on a C# 4.0 project in VS2010 and needed to use some older DLLs containing controls that were created in C# 3.5 on VS2008. When I first add the DLLs to the references, I was able to see the namespace via intellisense and create an instance of one of the controls, but when I go to build, it gives me the following error:
The type or namespace name 'BCA' could not be found (are you missing a using directive or an assembly reference?)
And I do have a using directive for that namespace already, which is now underlined in red, showing that VS cannot find it. And now, intellisense won't pick up that namespace at all.
I even tried added the controls to the toolbox (which worked) but then when I drag them to the GUI, it says that it cannot locate the DLL reference, even though it obviously knows where it is.
I even tried changing the target framework to 3.5, but still with the same results.
Any thoughts as to why this could be happening?
Edit - I've notice that in the csc.exe arguments that VS outputs, it does not have any /reference entries for the DLLs I'm trying to use. When I create the same basic project in VS2008, those entries exist. Also, I can successfully reference the DLLs in a DLL project in VS2010... it seems to just be WinForms projects that don't work.
Turns out that it was something to do with VS2010 defaulting to the .NET 4 client profile, as soon as I changed it to the regular profile it built fine. There's a day wasted...
view the target framework.. in my project, was 4.0 client profile, e the reference dll was in 4.0
I tried Build->Clean Solution and then could add the reference.
I used to have similar problem, but the profiles were not the issue, so the problem was that my class library use a special NuGet package that has Dependency... so I install the dependency package in the target project and added the project reference and works!
But I am not sure if there is a better solution for this problem??? for me VS should be smart enough to carry those dlls along with the references. (I already verified that "Copy Local" is set to True)