.NET Compiler could not find the reference - c#

I want to use a third party control (dll) in a Winforms application. I can integrate the control into the toolbox and then drag and drop it to a windows form. That all works. But during the compilation I get the error message:
The type or namespace name '....' could not be found (are you missing a using directive or an assembly reference?)
The library is also seen below references (solution explorer). But a corresponding "using statement" is missing. I am also not able to add a using... manually. The Intellisence doesn't provide me the missing item. So what is wrong here?

I am 99% sure that the Target Framework of your project is set to .net framework client profile. change it and all will be good.

Related

The referenced component 'ceTe.DynamicPDF.40' could not be found in VS Source Control

I am trying to debug a web app in VS Source Control. But, I am getting the error
The type or namespace name 'ceTe' could not be found (are you missing a using directive or an assembly reference?)
The referenced component 'ceTe.DynamicPDF.40' could not be found
On expanding the References folder in the Solution Explorer in Visual Studio, ceTe.DynamicPDF.40 is listed but marked with a yellow warning icon.
How do I fix this? I referred to this Refrenced Toolkit could not be found question but my problem is with the source control code. I do not have the related dll in my local repository of the project so I can't add it's reference.
Resolved this by copying over the respective dll file from the server.

MySql.Data.MySqlClient Reference Not Working in Visual Studio 2015

I've been attempting to connect a MySql database to my project in Visual Studio 2015. In order to connect it in the Server Explorer, I had to download and add the reference to my project. Easy peasy.
Then, when I attempted to follow this tutorial, I get this error message:
The type or namespace name 'MySqlConnection' could not be found (are you missing a using directive or an assembly reference?)
I have indeed added the assembly reference (I believe, if I understand the term correctly), by checking the MySql.Data in the References/Extension.
Am I using the wrong MySql.Data? How do I know which one? I've read that perhaps it can have to do with mixed versions of .NET Frameworks, but honestly I don't know how to check.
I'm an up-and-coming programmer, who before this, had only worked with static, hard-coded webpages, and never used databases in a project before.
EDIT: I have indeed added the 'using MySql.Data.MySqlClient to the same class file as I am attempting to use it in.
More information. What is displayed when I hover over the Data in MySql.Data.MySqlClient in the 'using' statements.
Your first screenshot shows the quickactions window suggesting that you use a fully qualified name, for the type, because it cannot determine where the type comes from.
Search to make sure that MySql.Data is not used, as a namespace, elsewhere in your project, so that it does not collide with the MySql.Data namespace from the dll you are referencing.

Missing reference

In project i have reference to Microsoft.Office.Word.Server
and in code i have method that takes argument of type ConversionJob, but when i try to compile it i have an errors
The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
The type or namespace name 'ConversionJob' could not be found (are you missing a using directive or an assembly reference?)
but when a press f12 on ConversionJob it tooks me to the class defenition
using Microsoft.Office.Word.Server.Service;
using Microsoft.SharePoint;
using System;
namespace Microsoft.Office.Word.Server.Conversions
{
public class ConversionJob
{
public ConversionJob(WordServiceApplicationProxy serviceApplicationProxy, ConversionJobSettings settings);
public ConversionJob(WordServiceApplicationProxy serviceApplicationProxy);
...
what is wrong?
target framework is .Net framework 3.5
Solution
Ive solve the problem. I look to the output and there was message:
Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "<assembly reference>" could not be resolved because it has an indirect dependency on the framework assembly "<assembly" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5". To resolve this problem, either remove the reference "<assembly>" or retarget your application to a framework version which contains "<assembly>"
i try to find solution in google and - > http://www.sanderstechnology.com/2011/warning-msb3268-you-are-about-to-experience-pain/10646/#.TtYrXGP20Z8
Check the target framework of your application, might be you´re building for the client profile but the referenced assembly requires the full framework.
Try changing the "Target Framework" to be ".NET Framework 4" instead of ".NET Framework 4 Client Profile".
Project Properties -> Application Tab -> Target Framework
You likely need to delete (MAKE SURE TO BACK IT UP) the 12.x.x.x .dll in your GAC folder, and make sure you are referencing the 14.x.x.x in your solution.
If you look at the project references, is it finding the assembly? The icon will look different if it can't resolve it.
1.Try to delete and then manualy add the reference (sometimes it helps - VS losting needed dll but not show it with another sign if not clean)
if 1. ok then backup and try to remove from GAC folder (to understatnd from where it calls assembly)
Probably you have a namespace or class with the name Office somewhere in your code. The compiler uses your namespace instead Office.
In other words I think you have a name collision with your project or any of the references you have in it.
Please investigate for overlapping namespaces / classes.

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

The type or namespace name 'XmlConfigurator' could not be found (are you missing a using directive or an assembly reference?)
Am I missing a namespace???
You have to add log4net.dll to your project and the using log4net.Config; namespace
Your missing dll. Right click on your project and Add Reference... point to correct dll.
There is the possibility that you have not added the dll. This would require right clicking your project and adding the reference DLL. There is one other step that wasn't mentioned in the previous answers that I found relevant.
There is the possibility that you are not using the correct runtime. I found that log4net requires a full profile. For instance the client profile for .NET 4 will generate this error but if you use the full profile you will not experience this.

i got an error in login code

I tried writing a login code in vc#.. I got the following error..
The type or namespace name 'LoginControl' does not exist in the namespace 'ErikSchmidt' (are you missing an assembly reference?)
Please help me rectify this error.
This means that Login Control is not visible to your code. What you need is specify LoginControl's namespace with using keyword or add assembly reference (with login control) to your project.
.NET projects must define which assemblies they require (such as System in most C# programs). It looks like you didn't add a reference to the assembly that contains LoginControl. Right-click on "References" in the project (in "Solution Explorer") and add a reference to the required assembly (which is wherever LoginControl is contained in).

Categories

Resources