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.
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:
C# set environment variable
(2 answers)
Ways to deploying console applications in C#
(5 answers)
Closed 4 years ago.
How can I make my console app installable so that when I open CMD I can run it from anywhere with a keyword. Like when I type in git in cmd for example. Thanks.
For this, you need to set up an environment variable called PATH. In Windows, it is in the registry. But for Mac or Linux you may want to update the .bash_profile file.
You can use the following function
SetEnvironmentVariable(String, String)
Here is the link for the MSDN .net core API
Then again I haven't tried this before. But hope this helps you out.
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:
How do I decompile a .NET EXE into readable C# source code?
(9 answers)
Closed 7 years ago.
I have been working on a project for my college course for a couple of months. When I went to submit it the other day the source code has gone missing. It was a WPF C# application. Because all of the work was done on my memory stick I have no backup of it.
I tried running a recovery tool but it was unable to find anything.
What I have is the following:
The contents of the bin > Debug folder including an up to date compiled version of the application (an exe file)
The .sln file for the project.
I really need the source code for this as without it I might end up failing the project. Is there any way to get it with what I have?
If you have DLLs you can use something like .netReflector and peep into code..
use dlls in a new project and then you can drill into them