Missing reference - c#

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.

Related

The type or namespace name 'Core' does not exist in the namespace

I encounter this kind of error when I debug a project
I already have EntityFramework.dll, System.Core.dll, System.Data.Entity but still Core is not referenced.
Can someone help me?
I'm having error in this Line
using System.Data.Entity.Core.Objects;
This is the error:
The type or namespace name 'Core' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?)
Enrique, I had this problem crop up when I started opening a project on my desktop that I had normally been opening on my VM. Masoud's answer is not helpful... I don't think he read your original post.
What I did to clear this compile error up was to open NuGet package manager and install the update that was available for EntityFramework. I had version 6.1.1 installed in the project and I upgraded to 6.1.3. I should not have had the error to start with, but upgrading the version appeared to jiggle whatever it was loose because I started compiling fine after that.
Sometimes, when you add references from other sources than nuget manager (example: Local source) you need to verify the HintPath of that reference before moving your application in another environment

How to diagnose an issue with csproj references?

I have an issue with a class being used in another project.
Visual studio is able to add a using statement using Resolve (Ctrl+.), but:
The type or namespace name 'SomeClass' could not be found (are you missing a using directive or an assembly reference?
Resolving this again fully qualifies the type but the namespace in the type path is highlighted as not being found.
The namespace appears also in intellisense and the target class is visible in the Object Browser.
Removing unused namespaces removes the added using statement.
I've tried:
Rebuild.
Confirm project dependency in solution options.
Delete reference and re-add.
Confirm class accessibility (despite namespace not being found).
Checked build mode (Debug/Release).
Restart Visual Studio.
Cleared bin folders in both projects.
Restart machine.
What is the next step to diagnosing this baffling issue?
This is likely to be a .Net framework versioning issue. The class being referenced was probably built using a higher version of the framework.
Try checking your framework versions all align in properties, build settings. A project cannot reference an assembly of a higher framework version.
Last time I had this problem my class was not marked public. Just an idea.
This issue was caused by similar namespaces e.g. Company.Product.Project and Product.Project with:
namespace Company.Product.Project
{
using Product.Project;
The class was in Product.Project, but the compiler was searching for Company.Product.Project.
See: Should 'using' statements be inside or outside the namespace? for more details.

C# using System.Linq error

Why might "using System.Linq" cause the following error?
The type or namespace name 'Linq' does
not exist in the namespace 'System'
Reference System.Core
And then there are others that merge this namespace too - but that's the primary one on .Net 3.5 and above.
If you're project is currently .Net 2.0, say, and you're using the right version of VS (2005 and above) - you can simply right-click on the proejct properties; and change the 'Target Framework Version' to 3.5. System.Core will then become available.
If you don't see that in the options - then I guess you're using an older VS
The most probable reason is that you are using wrong version of .NET Framework.
Try to add System.Core assembly to your project
You'll get this error if you don't have "System.Core.dll" referenced (the assembly which contains the core LINQ APIs).
System.Linq is available in .Net 3.5 and above version.
Maybe you're targeting an older framework, Linq came in with 3.5 IIRC.
You are using lower version of .NET Framework than 3.5 to compile the source code or you don't have added the System.Core assembly to your project.
Manually type using System.Linq in the starting of the project, you will not be able to find this namespace in add reference dialogue box.
If you are still getting error then try to Add Reference System.Core.
If you are getting an error that it has been already referred then you can unload your project and then edit your csproject file, manually copy reference to System tag and paste and change the name to System.Core and reload the project.
In my case the only thing that worked was:
Adding a new Razor item (e.g. MVC 5 View Page)
That automatically pulls in some NuGet packages
The package that makes System.Linq available to Razor Views IntelliSense seems to be Microsoft.AspNet.WebPages.

Namespace 'Smo' not found, although the reference is added

I have added Microsoft.SqlServer.Management.Smo.dll reference to my project, but it still gives me the error below. The referenced dll is in C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies path.
Error 25 The type or namespace name 'Smo' does not exist in the namespace 'Microsoft.SqlServer.Management' (are you missing an assembly reference?)
All the classes that I use such as Restore, Serer class under the Smo namesapce also throws the error.
Please advise.
Where are you consuming this from? Any chance you're using the client profile (under project properties -> Application -> Target Framework)? I've been caught out a number of times by that. If that's the case, it's usually as simple as selecting a non-client profile framework version.
Anyway, can we get some more detail about what kind of solution this is?
I have had the same problem, I noticed my project was targeting framework 3.
Changing to 3.5 or 4 helped solve the problem.
My reference are to
Microsoft.SqlServer.ConnectionInfo
Microsoft.SqlServer.Smo
Microsoft.SqlServer.Management.Sdk.Sfc
I think you have to add all 4 dlls (link):
Most of the classes
Microsoft.SqlServer.Management.Smo
namespace resides in the
Microsoft.SqlServer.Smo.dll and
Microsoft.SqlServer.SmoExtended.dll
files. Additionally, some of the
enumeration classes are in the
Microsoft.SqlServer.SqlEnum.dll and
Microsoft.SqlServer.SmoEnum.dll
assembly files. You will have to
import all four files to access all of
the classes in the
Microsoft.SqlServer.Management.Smo
namespace
If you are using Visual Studio 2008 then
Add References
Microsoft.SqlServer.ConnectionInfo
Microsoft.SqlServer.Smo
Microsoft.SqlServer.SmoEnum
Microsoft.SqlServer.SqlEnum
if still u got error
then add two more dll
microsoft.sqlserver.SmoEx...
Microsoft.SqlServer.ConnectionInfoEx...
Hope it will work
Thank you.
add reference to "Microsoft.SqlServer.Management.Sdk.Sfc.dll" from "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies" will eliminate this error.

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.

Categories

Resources