This question already has answers here:
C# using others code
(4 answers)
Closed 5 years ago.
I made a blank solution in C#( without any project ) and I added two Class Library Projects named "PersonLibrary" and "AnotherLibrary". The problem is that when I try to access the PersonLibrary from AnotherLibrary with: "using PersonLibrary;" I get this error: The type or namespace name "PersonLibrary" could not be found.
1
If you go to AnotherLibrary -> References -> Add Reference, you should see an option to add projects in solutions and add PersonLibrary .
Once you add a reference, You can use whatever the available methods.
Related
This question already has answers here:
How to solve circular reference?
(6 answers)
vs2008 circular references (c#)
(6 answers)
Resolving Circular References (C#)
(6 answers)
Closed 4 years ago.
So I have many projects in my solution.
AppName
AppName.Game
AppName.Common
AppName.Core
I'm currently hosting networking in AppName.Common because AppName requires it to initialize it, and AppName.Game requires certain classes from it to store propertys based on them classes.
The problem comes when I can't reference AppName.Common and AppName.Game both ways. Common requires the Game's classes to know what to call when a new packet comes in, and the game project needs the networking (DotNetty) to use the classes for the propertys.
I can't see why Microsoft have blocked referencing both ways, it seems like such a struggle to get to where you want to be? Is there any workaround for this?
The simplest and best way to do what you need is to move the code that both projects need somewhere that they can both access without having a circular reference. Add another project to your solution:
AppName.Networking
Put all the network stuff that both projects need into that and reference it.
This question already has answers here:
Does C# Support Project-Wide Default Namespace Imports Like VB.NET?
(5 answers)
Closed 5 years ago.
Is there a way to apply the reference " using mysql.data " to all windows forms in a project by not going to each form and typing it manually? Like an option from the solution explorer.
Here's one approach:
Edit -> Find And Replace -> Find in Files
in Find what box write: using System;
in Replace with box write: using System;\r\nusing mysql.data;
in Find options group check use regular expressions and in Look at these file types add *.cs
This question already has answers here:
Cannot find using System.Data.Linq
(6 answers)
Closed 5 years ago.
For some reason I can't reference System.Data.Linq. I added the reference in References but it doesn't work in the code.
I need access to System.Data.Linq.Mapping (didn't include it in the screenshot but that is the needed assembly).
I already tried searching the different questions regarding this, but the answers given there didn't work.
Right click your solution/project. Click Add Reference and search for
System.Data.Linq and add the reference there and it should compile.
If still not working : Check "Copy Local, True" in the Properties pane for the reference made it start working.
This question already has answers here:
'CompanyName.Foo' is a 'namespace' but is used like a 'type'
(8 answers)
Closed 6 years ago.
When I start a new empty project there is an error in the .net core project:
Controller is a namespace but is used like a type.
Am I missing some packages?
You're right, you've missed Microsoft.AspNetCore.Mvc package. Just add it to project.json and things will be OK.
This question already has answers here:
c# Where can find System.Windows.Controls.dll
(3 answers)
Closed 8 years ago.
I'm trying to add a reference to the namespace System.Windows.Controls in a library project, but i can't find it in the list. Does anybody know what is going on? i'm using 4.0. I want to add system.window.controls.dll but the library is not complete, how can i make it complete?
You have to look for this System.Windows.Controls.Data.dll assembly. In this assembly, there is the namespace you are looking for.
In general, a namespace and it's types may be in an assembly with different name than the namespace name.