I have a solution with about 12 projects, one is set as the startup project and this contains the main window. At the moment all of my IValueConverters are inside this project.
I now want to move them into a separate project that will hold only converters. This way I will be able to reuse them across all the projects, not just the main window.
I have created a new project (class library)
I have imported WindowsBase
I have Included a reference to System.Windows.Data
I am using Visual Studio 2010 Express with .NET 4
I get the error:
"Error 3 The type or namespace name 'IValueConverter' could not be found (are you missing a using directive or an assembly reference?)
"
You need to add a reference to PresentationFramework.dll, that's where IValueConverter is actually defined.
Looking at the documentation you can find that information at the top:
Namespace: System.Windows.Data
Assembly: PresentationFramework (in PresentationFramework.dll)
Please have a look here. I'm sure you're missing the library PresentationFramework.dll in your project.
Related
I have an MVC project that makes reference to a custom DLL in another project. The DLL is called "Web" and has the classes that I need in "Models".
I have added the DLL as a reference in the project where it is needed, and in the controllers and the models of the project, it is available. I can use the line:
using Web.Models.Base;
And
using Web.Models.AppToolKit
And all the objects in those classes are available.
However in the views, in that same project, the Web namespace is not available at all. I get:
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'Web' could not be found (are you missing a using directive or an assembly reference?)
And when I use the model I created in the project in the view, which inherits from the reference DLL and compiles with no problem, I get the error:
Error CS0012 The type 'BasicNetPageModel' is defined in an assembly that is not referenced. You must add a reference to assembly 'Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Even though that DLL is referenced, and is working in both the models and the controllers for the same project.
I am using VS 2019. I have tried removing/re-adding the reference and cleaning/rebuilding many times.
I have tried adding:
<add namespace="TASWeb.Models.Base"/>
in the web.config.
Any idea?
Looks like the problem was a second DLL, which was referenced from within the first DLL.
The project for that one was set to x86. I set it to ANY CPU, recompiled, then recompiled the first DLL, then the project in question was able to recognize the namespace.
My question in simple few lines:
I'm trying to build a compiled .dll C# Class Library that contains functions I want to easily call from other non-C# applications.
My functions depend on popular namespaces' Assemblies references like System.Windows.Forms and Microsoft.Office.Interop.OneNote.
When I try to add any of them to my class library, I get does not exist in the namespace error.
Also, they don't exist in Reference Manager (Screenshot 2).
Continued description:
Within normal C# application (that's compiled to .exe), I can easily include those Assemblies references using code lines like below:
using System.Windows.Forms; // works good in normal application
using Microsoft.Office.Interop.OneNote;
Also I am able to add References with References Manager (by right clicking the References node on Solution Explorer → then Select Add Reference → then search for the references I want to add) — in Visual Studio 2019 (Screenshot 1). I can find and add assemblies like System.Windows.Forms and Microsoft.Office.Interop.OneNote easily.
But within a C# Class Library (that's compiled to .dll), when I try to include System.Windows.Forms and Microsoft.Office.Interop.OneNote using the below lines:
using System.Windows.Forms; // gives errors in C# Class Library
using Microsoft.Office.Interop.OneNote;
I get errors:
CS0234 The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) MyLibrary C:\Path\to\MyLibrary\Class1.cs
CS0234The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) OneNoteLibrary C:\Path\to\MyLibrary\Class1.cs 15 Active
Also, these assemblies aren't shown at all when I try to add using References Manager (Screenshot 2).
Screenshot 1:
Screenshot 2:
Screenshot 3:
Hi I have some C# code in a .NET class library that I wrote a while back. If I want to reference that code in a Unity script (Unity 2018.4.19f1 if that matters), how do I go about that?
If I add a project reference to my Unity Assembly-CSharp project in Visual Studio, it doesn't seem to work. I get;
Script.cs(3,7): error CS0246: The type or namespace name
'other-project-namespace' could not be found (are you missing a using
directive or an assembly reference?)
Does the class .NET class library need to be target a particular framework/platform? Ideally I'd like to use the same library across platforms if possible.
you need to build it, then it gave you a DLL file
import that in unity and use it
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.
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.