I'm trying to define a function which accepts as a parameter an object of type System.Web.HttpPostedFileBase.
At the top of my class I included using System.Web; and the compiler is not too upset with that using statement. (It claims the statement is not necessary, but it is not throwing an error.)
However, the compiler gives the following error when I define a parameter of type 'HttpPostedFileBase': The type or namespace name could not be found (are you missing a using directive or an assembly reference?)
Why is the compiler throwing this error? I included the necessary using directive and assembly reference, no?
You need to add a reference to System.Web from the Solution Explorer side panel. Simply adding a using statement will not add the reference.
Related
I am using CefSharp WinForms in my project and i cannot get it to execute a JS script from the CefSharp Browser Control
(I was to navigate to URLs though - so most of the CEF functionality works)
I tried following the tutorial at: https://github.com/cefsharp/CefSharp/search?utf8=%E2%9C%93&q=BoundObject
I am using the following namespaces:
using CefSharp.WinForms;
using CefSharp.Internals;
and added references to the following assemblies (x64):
CefSharp.WinForms.dll
CefSharp.dll
CefSharp.Core.dll
but still I get the following error when I try to use one of the functions:
ExecuteScriptAsync or EvaluateScriptAsync
I get the following error:
'CefSharp.WinForms.ChromiumWebBrowser' does not contain a definition for 'EvaluateScriptAsync' and no extension method 'EvaluateScriptAsync' accepting a first argument of type 'CefSharp.WinForms.ChromiumWebBrowser' could be found (are you missing a using directive or an assembly reference?)
'CefSharp.WinForms.ChromiumWebBrowser' does not contain a definition for 'ExecuteScriptAsync' and no extension method 'ExecuteScriptAsync' accepting a first argument of type 'CefSharp.WinForms.ChromiumWebBrowser' could be found (are you missing a using directive or an assembly reference?)
can anyone direct me to the point i am missing? is there another API? maybe some reference dll that I am missing?
thanks
You may be missing one other namespace. I would suggest you add:
using CefSharp;
We were having the same trouble and found that we were simply missing this one.
We now have:
using System.Text;
using CefSharp;
using CefSharp.WinForms;
using CefSharp.Internals;
CaptainBli is correct: you have to use "using CefSharp"
Probably you didn't expect it there, since it seems to be in another namespace: "CefSharp.WinForms.ChromiumWebBrowser".
This is because EvaluateScriptAsync and ExecuteScriptAsync are extension methods
I know this is a common error but I have the correct reference to the System.Data.DataSetExtensions.dll added to the project and my project is a SQL CLR project built for .net 4.5 and I'm getting the error at the following line:
using System.Data.DataSetExtensions;
I also checked the properties for the dll and it is referencing the correct version for the 4.5 dll so what else could possibly be causing this issue? Is this an issue with SQL CLR projects?
System.Data.DataSetExtensions is an assembly, not a namespace. You just need to add a reference to System.Data.DataSetExtensions.dll (as you say you already have) and then a using directive for the System.Data namespace:
using System.Data;
That will pull in all the extension methods in the classes in that namespace, e.g. DataRowExtensions.
When you're looking in documentation, always be careful about the difference between namespaces and assembly names - they're often the same, but they're logically independent.
I have a solution with two projects in it, both class libraries built with .NET Framework 4. The first is an EF model assembly called Gilbane.SRP.Data. I added that reference to the 2nd project Gilbane.SP.Logging. I keep getting the error:
The type or namespace name 'Data' does not exist in the namespace 'Gilbane.SRP' (are you missing an assembly reference?)
on the line in the Logger:
using Gilbane.SRP.Data;
This is even though it is required and finds it ok, Resharper shows that using as being necessary, and completion in the code editor allows me to add Gilbane.SRP.Data.
What else could it be?
I have added a ADO.Net Entity Data Model in my website and named it WebSocketModel. Thus, all of its code has been generated inside the name space WebSocketModel inside the App Code folder.
But now I am unable to reference this namespace. I need to use the context classes created inside this namespace to fire LINQ queries.
I tried to reference the namespace through the using WebSocketModel; statement inside my web form but am getting the error
The type or namespace name 'WebSocketModel' could not be found
(are you missing a using directive or an assembly reference?)
What is even more perplexing about this error is that whenever I type using intellisense automatically suggests the namespace WebSocketModel. However, later when I build my website, I get the aforementioned error.
OK took a long time but finally resolved this issue...I just deleted the entity model and added it again. After doing so, I got a new error:
The type 'PatientBPData' is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute. POCO entities that do not use EdmEntityTypeAttribute cannot be contained in the same assembly as non-POCO entities that use EdmEntityTypeAttribute.
And to resolve this I found this incredibly helpful
I added using Microsoft.VisualBasic to my code but compiler reports error CS0234:
The type or namespace name 'FileSystem' does not exist in the namespace 'Microsoft.VisualBasic' (are you missing an assembly reference?)
What is this "assembly reference" and how to add one?
Error also shown in the picture
http://img16.imageshack.us/img16/6517/errorcup.jpg
You've got a using directive for the Microsoft.VisualBasic namespace, but the fact that you're fully-qualifying the name Microsoft.VisualBasic.FileSystem makes that irrelevant.
I suspect you just haven't added a reference to the Microsoft.VisualBasic.dll assembly. (Assemblies and namespaces are very different things.)
Personally I would attempt to avoid VB-specific assemblies in the first place, to be honest.