Type or Namespace Error - c#

I have two references in my application. In the BAL code i am able to use the namespace "using TestDAL;"
But I am not being able to use the namespace of BAL in my .cs page. This is the error i get,
CS0246: The type or namespace name 'TestBAL' could not be found (are
you missing a using directive or an assembly reference?)
And one thing in my bin folder too I only have the TestDAL.dll file. How do I insert TestBAL.dll file?
Can anyone help me with what can be possible reason?
Thanks in Advance,

Try this:
Then, click browse and add your .dll file:
That should help you, if not please leave some feedback.
You could also try using alias for your namespace like this:
using namespaceAlias = TestBAL;

Create object of TestBAL objBAL = new TestBAL(); in your cs page. Check out, This codes gives any error or not.

Related

Does anyone know why system and console isn't working here?

using System;
using SplashKitSDK;
public class Program
{
public static void Main()
{
console.WriteLine("Hello World");
}
}
Some of the errors I am getting:
Unnecessary using directive. [Helloworld]csharp(CS8019)
The type or namespace name 'System' could not be found (are you missing a
using
directive or an assembly reference?) [Helloworld, Helloworld, Helloworld,
Helloworld]csharp(CS0246)
Predefined type 'System.Object' is not defined or imported
The name 'Console' does not exist in the current context
I've tried everything, and nothing seems to work. I also believe I installed the language tools and library correctly. If anyone knows how to fix this please let me know. Thanks!

The type or namespace name 'VibrationDevice' could not be found

I try to implement vibration in my UWP app by following the example from the VibrationDevice API reference. I have a new empty project with the following code:
using Windows.Phone.Devices.Notification;
...
if (ApiInformation.IsTypePresent("Windows.Phone.Devices.Notifications.VibrationDevice"))
{
VibrationDevice testVibrationDevice = VibrationDevice.GetDefault();
testVibrationDevice.Vibrate(TimeSpan.FromSeconds(3));
}
This code throws the following exception
The type or namespace name 'VibrationDevice' could not be found (are you missing a using directive or an assembly reference?)
I have searched for someone with the same problem but I have not found anything similar and don't really know how to solve this.
What am I missing?
EDIT: As Hans Passant pointed out in the comments I had forgot to add the Mobile Extension. Now everything works as it should.
Looks like you just mistyped the namespace string.
if
(ApiInformation.IsTypePresent("Windows.Phone.Devices.Notifications.VibrationDevice"))

Object in ProjectReference not accessible when using 'Import'

In a simple project i want to reference objects from a webreference added to another c# library.
The Webreference is called QServices The default namespace is set as below
What seems to work is the following code:
Taskworkflow.SI.QServices.Record[] querysResult = new Taskworkflow.SI.QServices.Record[0];
yet when i import the Taskworkflow.SI - namespace, i keep on getting errors:
using TaskWorkflow.SI;
....
QServices.Record[] querysResult = new QServices.Record[0];
This results in the error:
The type or namespace name 'QServices' could not be found (are you missing a using directive or an assembly reference?)
Could someone clarify this for me?
Thank you for your time.
Note: QServices do only exist inside TaskWorkflow.SI. They do not have any occurences in other projects nor do they have any classes/namespaces/objects that share the name.
I strongly suspect that for whatever reason, you're ending up with a namespace called QServices declared in the TaskWorkflow.SI namespace. So actually you want:
using TaskWorkflow.SI.QServices;
....
Record[] querysResult = new Record[0];
Or you could explicitly alias it:
using QServices = TaskWorkflow.SI.QServices;
....
QServices.Record[] querysResult = new QServices.Record[0];

Linq to MySql GetTable

I am trying to insert/add a data into my Database but it seems that this part of code won't work The name of the table that I am trying to add data on is "People"
Table<People> users = myDb.GetTable<People>;
Has an error on the Table<People> users why is this error occurring?? how would I fix this?
just in case you need the stack trace, here it is.
Error 1
The type or namespace name 'Table' could not be found (are you missing a using directive or an assembly
reference?)
C:\Users\John\documents\visual studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs 23 13 WindowsFormsApplication1
You need to add
using System.Data.Linq;
to the top of your file to bring the Table class into scope. Alternatively you could use:
var users = myDb.GetTable<People>();

RazorEngine Razor.Parse(...) throws exception about ServiceStack and Markdown?

I ran this simple example from the website and I get the error below when it calls Razor.Parse. How can I fix this???
http://razorengine.codeplex.com/
string template = "Hello #Model.Name! Welcome to Razor!";
string result = Razor.Parse(template, new { Name = "World" });
error CS0234: The type or namespace name 'Markdown' does not exist in the namespace 'ServiceStack' (are you missing an assembly reference?)
Not sure why you've linked to http://razorengine.codeplex.com
The 'ServiceStack' error assumes you want to use the Markdown engine in ServiceStack in which case you should be referencing the RazorEngine.dll that comes with ServiceStack not the one in razorengine.codeplex.com if that's what is done here.
I would imagine one of two things has happened. Either in your configuration file, namespaces have been added within the <razorEngine> configuration section, or the AddNamespace method is being called somewhere to include namespace imports in the compiled template.
The net result, is that namespaces are added to the generated class file, but references are missing. RazorEngine will automatically reference any loaded assemblies in the AppDomain.

Categories