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.
Related
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?
Cleaned and rebuilt everything many times, restarted VS and computer but no progress. Patching some bugs in the QueryCommander open source project, I came across an issue where Debug builds, but Release does not. I get this error in Release mode only:
CS0246 The type or namespace name 'AxSHDocVw' could not be found (are you missing a using directive or an assembly reference?)
QueryCommander.Help C:\Workspace\QueryCommander_4_0_0_0\QueryCommander.Help\WinGui\FrmHelpBrowser.cs
The reference does actually exists:
And it does contain the missing namespace:
The unit FrmHelpBrowser.cs does not have a using directive indeed, but I am not sure why that works in Debug mode and what should be used here:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using QueryCommander.Help.WinGui.Base;
namespace QueryCommander.Help.WinGui
{
/// <summary>
/// Summary description for FrmHelpBrowser.
/// </summary>
public class FrmHelpBrowser : FrmBaseContent
{
public AxSHDocVw.AxWebBrowser axWebBrowser1; // Error on this line
//----------------^ here
What is missing in the release mode?
Argh! The reference in the original project was to the DLL sitting under bin\Debug (looking at the reference properties window). I deleted the reference and added it using the AxInterop.SHDocVw.dll in the solution's root directory - problem solved!
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'm trying to use Bouncy Castel dll in my project. When I add it to my references I can't use it and when I write this code:
using BouncyCastle.Crypto;
I face with this error:
The type or namespace name 'BouncyCastle' could not be found (are you missing a using directive or an assembly reference?)
what should I do?
I have checked it Micheal, you should write this:
using Org.BouncyCastle.Crypto;
instead of:
using BouncyCastle.Crypto;
I'm trying to compile a C# script with Mono on Debian by command line, like this:
gmcs Main.cs
However, I get the following error:
Main.cs(6,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
Main.cs(7,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
Main.cs(12,7): error CS0246: The type or namespace name `iTextSharp' could not be found. Are you missing a using directive or an assembly reference?
Main.cs(13,7): error CS0246: The type or namespace name `iTextSharp' could not be found. Are you missing a using directive or an assembly reference?
Main.cs(1526,31): error CS0246: The type or namespace name `Bitmap' could not be found. Are you missing a using directive or an assembly reference?
Main.cs(6,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
Main.cs(7,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
Main.cs(12,7): error CS0246: The type or namespace name `iTextSharp' could not be found. Are you missing a using directive or an assembly reference?
Main.cs(13,7): error CS0246: The type or namespace name `iTextSharp' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 9 error(s), 1 warnings
These the references at the top of Main.cs:
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using iTextSharp.text;
using iTextSharp.text.pdf;
I understand that I have to tell Mono which libraries to include by adding -pkg:whatever. My problem is that I do not know what these libraries are called, so I don't know what command is used to include them. Actually, I don't even know whether I have to download these libraries from somewhere or whether they come with Mono.
Note also that the last 2 are the iTextSharp library, for which I have itextsharp.dll just placed in the same directory as the script, since I don't know what else to do with it.
Please could someone explain to me how to get the file to compile!
Try this:
gmcs /reference:System.Drawing.dll /reference:itextsharp.dll Main.cs
With newer versions of mono, try this.
mcs /reference:System.Drawing.dll /reference:itextsharp.dll Main.cs
Here's another solution that's worked for me in a similar case where I got this error:
Eventdemo.cs(2,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing `System.Drawing' assembly reference?
Eventdemo.cs(3,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference? │
Eventdemo.cs(8,19): error CS0246: The type or namespace name `Form' could not be found. Are you missing an assembly reference?
I had those references in my program:
using System;
using System.Drawing;
using System.Windows.Forms;
I got the solution from ubuntuforums:
gmcs -pkg:dotnet *.cs
I got this error, and when I just needed to use System.Net.Http, I used:
$mcs /reference:System.Net.Http.dll Program.cs
and it worked fine for me. When I tried to include the full path to System.Net.Http.dll, it didn't work. That is to say, heads up, mono keeps track of paths. Also, I have the latest version of mono.