In Visual Studio, I have a project with System.Web.Helpers as a reference for the solution. In one of my files I have
using System.Web.Helpers;
It tells me Using directive is unnecessary. AntiForgeryConfig is within one of my files and it tells me 'The name 'AntiForgeryConfig' does not exist in the current context'.
var antiForgeryCookie = request.Cookies[AntiForgeryConfig.CookieName];
How do I fix this?
Related
I am trying to import Steamworks from the Steamworks.NET package that I imported through the unity package manager.
I can clearly see that the Steamworks.NET package was installed and that it contains the namespace Steamworks.
However, when I actually try to use this namespace, like this:
using Steamworks;
I get the error:
Assets\Scripts\SteamIntegration\SteamManager.cs(15,7): error CS0246: The type or namespace name 'Steamworks' could not be found (are you missing a using directive or an assembly reference?)
This makes no sense to me - The namespace clearly exists in the project. Why can I not use it / How can I use it?
You seem to be using an Assembly definition for your scripts.
In that case you additionally will need to reference the assembly definition of according package(s).
In your case the file starting with com.rlabrecque....
On Mac Visual Studio - Xamarin Project, I get an error:
the type or namespace 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference)
I have tried to resolve it by using the nuget package manager. Specifically, click 'Packages' folder and click 'Add Packages...' and add Linq. Yet it still does not find Linq when I write 'using System.Linq' yet I can see 'System.linq' in the package folder under the project.
Tried : Refresh, Update, turn off and on
Why can't it find and use the package?
Edit: For similiar error 'HttpStatusCode' where it not found under 'System.Net' yet I have the dll (Version 2.0.5.0) found. I tried to install a new nuget package for it, System.Net.Primitives (Version 3.0.9.0) where 'HttpStatusCode' is stored under this new version. When I reference System.Net.Primitives it does not work.
Example:
'\\ The type or namespace name 'Primitives' does not exist in the namespace 'System.Net'
Using System.Net.Primitives;
Using System.Net;
namespace code {
public class Example
{
\\ the type or namespace 'HttpStatusCode' could not be found
public HttpStatusCode HttpResponse;
}
}`
You need just to add System.Core to your References.
In one of my project I solved it by following way:
Open solution explorer. Right click references, Click on assemblies, select system.xml.linq.
Add the reference assembly to the project. Clean and rebuild.
It should serve the purpose.
Add this .nuget to your Solution. Micosoft.Net.Http.
I'm trying to build this Visual Studio C# Solution : TreeViewAdv
I get compile errors like this:
Using Directive is unnecessary The type or namespace name
'VisualStudio' could not be found (are you missing a using directive
or an assembly reference?)
on the line:
using Microsoft.VisualStudio.TestTools.UnitTesting;
So I remove that line I get this error:
Error CS0246 The type or namespace name 'TestClass' could not be found
(are you missing a using directive or an assembly reference?)
This question says to add a reference, but I don't see the reference it refers to.
What gives?
Code example:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Aga.Controls.Tree;
using System.Collections.ObjectModel;
namespace Aga.Controls.UnitTests
{
/// <summary>
///This is a test class for Aga.Controls.Tree.TreeNodeAdv and is intended
///to contain all Aga.Controls.Tree.TreeNodeAdv Unit Tests
///</summary>
[TestClass()]
public class TreeNodeAdvTest
{
private TestContext testContextInstance;
Edit:
In response to the "duplicate" flag:
The directory C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE does not have a Public Assemblies folder. Also I don't have a C:\Program Files\Microsoft Visual Studio 15.0, which I can't say that I understand. Maybe 15 is using the 12 directories?
With Visual Studio 2013 I do the following steps to build the project:
Remove the reference Microsoft.VisualStudio.TestTools.UnitTesting from the project Aga.Control.Unit.Tests
Add the same reference but from this directory C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies.
My C# file shows 3 different errors related to missing assembly references.
I am using Xamarin studio and not sure where the references are located. The assembly browser?
Here is where the errors are:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
using System.Net;
using System.IO;
using System.Threading;
using System.Diagnostics;
using System.Collections.Specialized;
using Microsoft.Win32;
using System.Windows.Forms;
Errors:
Error CS0234: The type or namespace name 'Net' does not exist in the namespace 'System' (are you missing an assembly reference?) (CS0234) (class)
Error CS0234: The type or namespace name 'Specialized' does not exist in the namespace 'System.Collections' (are you missing an assembly reference?) (CS0234) (class)
Error CS0234: The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?) (CS0234) (class)
Try to eliminate the errors by adding references one by one. If the error is thrown try to right click on the References in your project in Solution Explorer and add reference which seems to match to the one which causes error. If this won't help the cause is somewhere else, then post more data about the problem.
I don't know if you're still having this problem, but I fixed a similar issue (System.Collections.Specialized does not exist) in Xamarin Studio 6.3 by adding a reference to System through the Edit References dialog.
1_Go to your error giving project.
2_Right click>Add>Reference.
3_Search for 'Net' in Reference Manager window.
4_Find "System.Net" check the box right left to it and click OK.
I use visual studio 2019
when I get this errors,
the fixes is this
1)go to solution explorer. 2) right click on your solution. 3) Add. 4) Reference... 5) In reference manager window search for System.Net 6) check the box. 7) OK
This worked for me.
1
2
3
4
5
I am making a weather app using C# in Visual Studio 2013.I have used the namespace System.Xml and also added the reference of System.Xml.XmlNode using the object browser.
But still when I am trying to use the namespace XmlNode it is showing the following error:
The type or namespace name 'XmlNode' could not be found (are you missing a using directive or an assembly reference?)
Am I using any broken reference?
And how to rectify this error?
As you see at http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.aspx it requires namespace System.Xml in System.Xml.dll assembly.
So first add a reference to System.Xml.dll and then add the following using statement in your code:
using System.Xml;
Check whether your project references the System.Xml.dll assembly.
Make sure your assembly references System.Xml.dll
Make sure to put using System.Xml; in the top of the .cs file