I can't compile a project because the namespaces System.Web.UI and System.Web.Security are missing. I can only see System.Web.ApplicationServices, System.Web.Mvc and System.Web.Services when I do add references. Where do I download the missing namespaces?
Go to menu Project -> Add reference and find out the System.Web.dll in the list
I don't know about System.Web.UI, but System.Web.Security moved to the System.Web.ApplicationServices assembly in .NET 4.0 Framework.
Following Kinderchocolate's suggestion, I switched to ".Net Framework 4" in my project's Properties (VS 2010), and that caused "System.Web" to appear in the assemblies list. From then on I was finally able to use System.Web.UI.
So I'm not sure what failed for kinderchocolate, but his change worked for me.
You can add System.Web.ApplicationServices assembly in .NET 4.5 Framework.
using System.Web.ApplicationServices;
Yes, Kinderchocolate is correct. Once you add the Reference System.Web to your project, then in the code you can add using System.Web.UI and all sub-components of System.Web.UI, e.g. System.Web.UI.HtmlControls.
you can go to : project -> proprieties -> and change the Framework from Client profile to .Net 4, if it doesn't work you can add the reference manually. Good luck
Add references System.Web.Extensions and System.Web.Extensions.Design in 4.6.1
if you miss ListView or LinqDataSource
Related
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 have business layer in my solution. I added console project to the solution. Added necessary reference to console application. Created instances of classes in business layer. I'm using resharper so code looks correct.
when I try to build I get the error like
Error 127 The type or namespace name 'BusinessLayer' could not be found (are you missing a using directive or an assembly reference?) C:\ConsoleApplication\Program.cs 13 25
if I reference business layer from web project under the same solution it compiles, but with console it's not.
do you have any idea what can be the problem?
Add using BusinessLayer; in the top of your application, if you already did that, then try to clean and rebuild the solution.
Also make sure that both the library and the console application have the same .net framework version, for example both are 4.0 and not one of them 4.0 client profile...
You seem to confuse a library (project) reference and a using statement judging by your comment:
I have the reference at the top of the page.
You need both to add a reference (right-click your project's References folder in Solution Explorer > Add Reference...) and add a using directive at the top of the code file to import the required namespaces.
You'll have to add a reference to that assembly from your console project.
You add references at the project level not the solution level, so the reference you added to your web application doesn't help your console app.
Right click over your solution, configuration manager, you will see all projects, be sure that you have marked all necessary projects to build with right platform.
Hope it helps.
Rebuild the BusinessLayer class library and build your solution again.
I have a C# project which has a namespace A. The output of the project is a library(dll). When I try to add a reference to this dll file from another project, I am not able to see the namespace A present in the dll. Is there anything that I should do while creating the dll file so as to see the namespace? Please help me in this regard at the earliest.
Thanks,
Rakesh.
Make sure that you are:
Adding a reference to the DLL in the consuming projects references setting.
Made your classes public.
Including a using statement at the top of your file, or referencing the full namespace to the type that your dependent project is consuming.
Project References:
Make sure the version of the .Net framework targeted by your dll matches that of the program you are trying to reference it from. For example, if you have an assembly which targets the 4.0 framework and you try to reference it from a project which is targeting an older version of the framework you can run into these weird problems where you can't find the types in the assembly.
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)
I am using Visual Studio 2008 with the .NET Framework (v3.5). I cannot seem to use System.Windows.Shapes, or anything System.Windows.* besides Forms.
Here is the link to the class description:
System.Windows.Shapes (MSDN Library)
Is there some special thing I need to do to use it?
I checked in all of the framework folders, and the only dll/xml files I have for System.Windows is System.Windows.Forms.
What do I need to do to get this to work?
This class is part of WPF, from MSDN:
Shape Class
Assembly: PresentationFramework (in presentationframework.dll)
You need to add a reference to the PresentationFramework library.
In VisualStudio, right click on your project in the "Solution Explorer". Select "Add Reference". The "PresentationFramework" library will be under the ".NET" tab. You may also need to add "PresentationCore" and "WindowsBase".
You can see your project's current library references by going to the "Solution Explorer" and expanding the "References" item.
You may need to add a reference to the library, probably System.Windows.Presentation
Edit: It is in the PresentationFramework library
Add reference to PresentationFramework from .Net tab
write using System.Windows.Shapes
and you are done!
Other solution that works in .Net 4.0:
Go to referenes->add reference and choose PrsentationFramework under .NET tab.