Can not add System.Data.Linq [duplicate] - c#

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.

Related

Struggling to understand project referencing? [duplicate]

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.

Apply an added reference to all windows forms [duplicate]

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

HttpUtility.HtmlDecode() [duplicate]

This question already has answers here:
HttpUtility does not exist in the current context
(10 answers)
Closed 5 years ago.
I'd like to use HttpUtility.HtmlDecode() to process some strings in my application, but for some reason Visual Studio doesn't seem to know where it's at.
I'm fairly new to C# so I'm just guessing I've missed something like importing a library, but I don't even know what to Google.
I've tried using System.Web but it only seems to contain AspNetHostingPermission and friends, no HttpUtility.
I'm using VS2015 Community Edition on a Windows 10 machine.
I've tried "using System.Web" but it only seems to contain "AspNetHostingPermission" and friends, no HttpUtility.
You simply need to reference the DLL System.Web, right click References > Add Reference > Assemblies > Framework > System.Web
Also check you're not targeting the Client Profile, in which System.Web.dll is not available. You can target the full framework in Project Properties.

Class library C# [duplicate]

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.

How can I use ReSharper to list unused methods in a solution? [duplicate]

This question already has answers here:
Find unused code [closed]
(9 answers)
Closed 9 years ago.
In a legacy ASP.NET project I have inherited, there are an abundance of methods defined which are used absolutely nowhere.
I'm familiar with the "Find usages" functionality, but would like to be able to generate a list of methods which are not called anywhere in the app. Does such functionality exist?
You can select ReSharper => Inspect => Codes Issues in solution ;
And there, you can group by "Issue Type" and you should see all issues that match with "Type or type member is never used" (unused method goes there)
(And if you click right on it, you can select : "Show only "type or type member is never used" issues" .. and there you go ;)

Categories