what should I do about missing namespaces? - c#

While using Visual Studio C# Express 2010, I've noticed a small problem; namespaces such as System.Windows and System.Drawing are missing, so where could I find them, or can I download them online?
P.S: I've opened the System reference and really got worried as I didn't find those references.

The two assemblies you mentioned are available only for Windows applications. If you are creating a console application such assemblies are not even shown in the Add References.

Under your references folder, in the Solution Explorer click Add Reference
Click the .NET tab.
Find your reference.

When you open up your Add Reference dialog you should have a .NET tab. In there you should find the references you require.
System.Windows may not be there but its members should be.

Related

Adding reference to C# Project

I'm having an issue adding a reference to my C# project. I need to add a dll called PhpNetCore. I have located this DLL with Windows Explorer in Assembly\GAC_MSIL\PhpNetCore. However, when I browse with the Visual Studio explorer to add a reference to the DLL it doesn't show up. They are simply not visible. What gives?
Using Windows Explorer, I copied the PhpNetCore folder to my desktop. I was then able to add a reference without any issues.
Thanks in advance for any help.
-Geoff
That's "as designed" for Visual Studio. The GAC is for publishers to share assemblies with multiple applications. Publishers can share assemblies with developers in Common Files\Reference Assemblies.
The ideal method of adding a reference to your project is to use the NuGet package manager.
If neither of those are available, copying is okay, too.
I am not sure about that library but I found a way to use it installation free if this is of any help.
Installation-Free Phalanger

missing reference in visual studio 2010

i am using visual studio 2010 and arcgis server 10 to develop Server Object Extension and while developing the manager property page esri.arcgis.servermanager is missing how to include this assembly reference in my project.
i am using this link for help http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/How_to_develop_a_property_page_for_the_REST_SOE/000100000nwm000000/
plz help me asap.
First of: I am not familiar with ArcGIS Server, but I might be able to help you with some general remarks.
Check that the assemblies listed under step 6 of the link you posted are visible under References (when you expand it) in the Solution Explorer of Visual Studio. If not, you'll need to add them.
To add a reference to a assemblies, right-click the References item in your Solution Explorer and click Add Reference.... Find the assemblies that you have to include (e.g. ESRI.ArcGIS.ServerManager). This is essentially steps 5 and 6 of the link you posted. If you've done this correctly, they should appear under References in your Solution Explorer.
Note that the documentation states that the ServerManager requires the Web Applications component of ArcGIS Server. Ensure that you have this, or it might not work.

What reference do I need to use Microsoft.Office.Interop.Excel in .NET?

I am interested in using C# to manipulate/Automate Excel files.
After browsing the web I have found VSTO but it seems you can not use that in Visual Studio Express Edition so I can not use that.
Just few minutes ago I noticed a question in this site that used this namespace in its code:
Microsoft.Office.Interop.Excel
So I am wondering if all I need to use that is add necessary reference and if so which reference to add?
UPDATE
I installed "Primary Interop Assemblies" as the accepted answer suggested but for some reason they are still missing in the Add Reference dialog under ".NET" but they are present in GAC.
So I just added the reference using "Browse" and located Microsoft.Office.Interop.Excel.dll in GAC folder.
But looking for similar questions on this site regarding adding reference from GAC it seems this is not recommended.
Update (thanks user2347528)
These assemblies are available as NuGet packages, which is much easier than my original answer.
You can install by either right clicking on References in your project and selecting Manage NuGet packages... and searching for one of the packages listed below, or install using the Package Manager Console:
PM> Install-Package Microsoft.Office.Interop.Excel
Microsoft.Office.Interop.Excel
Microsoft.Office.Interop.Word
Microsoft.Office.Interop.Outlook
Microsoft.Office.Interop.PowerPoint
Microsoft.Office.Interop.Graph
These are available as "Primary Interop Assemblies", which can be installed with Office, or downloaded and installed separately. How to: Install Office Primary Interop Assemblies.
Once those are installed, you can reference them in your project in the Add Reference dialog, under .NET. If you do not see those Microsoft.Office.Interop assemblies listed, then they have not been installed yet. Install them from your setup, or download and install them separately (see my link above for the downloads).
Just had this problem myself and accepted answer didn't help me but I solved it with:
Add reference > Browse > C: > Windows > assembly > GAC > Microsoft.Office.Interop.Excel > 12.0.0.0_etc > Microsoft.Office.Interop.Excel.dll
Answers didn't help me to solve my problem, I couldn't find (and browse) the assemblies although I installed them using Microsoft's msi installer. For me, the excel assembly is located under C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\14.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll
Just add reference of Microsoft.Office.Interop.Excel.
It includes MicroSoft Excel related classes, no need to add more references.
I guess what you are trying to do is add Microsoft.Office.Interop.Excel with using statement with out adding its reference in your application, in that case it wont be found. Before calling it with using statement you need to add a reference to ur application. Right click on References and add the Excel Interop reference.
Add reference > Browse > C: > Windows > assembly > GAC > Microsoft.Office.Interop.Excel > 12.0.0.0_wasd.. > Microsoft.Office.Interop.Excel.dll
I found it located under Assemblies->Extensions in VS2013.
If you have Microsoft Office installed, then you should be able to add a reference to Interop.Excel.
For example, the PC I'm typing this on has MSVS 2010 C# Express and Office 2010. I can add a reference to Microsoft.Office.Interop.Excel 11.0.0.0.
'Hope that helps
its in the com component, named:
"Microsoft Office 14 Object Library"
I just had the same problem, but none of these answers helped me. I did find the dll on my pc in the location Mostey noted: (C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\14.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll), but this is not the one that was referenced in the project I was trying to get building.
The reference in our project in Visual Studio 2012 was pointing to C:\Program Files (x86)\Microsoft Visual Studio 11.0\Visual Studio Tools for Office\. This location was empty for me, but it worked fine for everyone else. It took a number of tries, but I finally tracked down a working installer. I hope this saves others the same hassle!
--> Office Tools Bundle installer for VS2012 <--
This was located on the Office Documentation and Download page. Scroll down to Tools Downloads. There's also currently one for VS2013.
The best option since office 2007 is using Open XML SDK for it.
We used Word.Interop but it halt sometimes, and it is not recommend for Microsoft, to use it as a server side document formatting, so Open XML SDK lets you creates word documents on DOCX and Open XML formats very easily.
It lets you going well with scability, confidence ( the files, if it is corrupted can be rebuild ), and another very fine characteristics.
Here is super solid solution, you just need have excell.dll in your Debug/Release folder
Mine is 77,824 bytes, I downloaded it as a file, this also explain why some people have Debug compiled but Release not or vice versa.
Trento
1.Download and install: Microsoft Office Developer Tools
2.Add references from:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Visual Studio Tools for Office\PIA\Office15
I had the same issue and the Microsoft.Office.Interop was not appearing in "Add Reference" option once I upgraded VS2012 to VS2015. I basically repaired the installation (Control Panel > Programs & Features > VS 2012 > Right click Change > Repair) and added the Microsoft Office component. After that the same solution started working.
Make sure your project is 32 bit.
I had this problem, as soon as I ticked "Prefer 32 bit and rebuilt" all the Office Interop assemblies where available in Reference->Assemblies->Search "Office".

Error Message when Referencing .dll Files

I would like the use DirectInput in my XNA game however I'm having an issue when it comes to referencing the .dll file. I'm using Microsoft Visual Studio C# Express Edition. This is exactly what I do:
right click "References"
chose "add reference"
navigate to the .dll file and hit OK
I then receive the following error:
As stated above I would like to reference the Microsoft.DirectX.DirectInput namespace but I don't know which .dll file that it's in so I just picked the "d3dref9.dll". Every .dll file under that directory doesn't work though so any one I pick gives me the same error. Now I've been able to accomplish this with other .dll files but for some reason the DirectX ones wont work. I know it's possible beacuse this guy did it just look at the second line in his code.
I have the DirectX SDK installed why can't I reference any of the .dll files and how can I make it so I can?
Thanks!
The problem here is that you are adding a reference to a native DLL while managed projects only support managed DLLS. I believe the DLL you are looking for is Microsoft.DirectX.dll. That has the managed wrappers for DirectX
I think you are trying to reference .dlls that are not .NET assemblies, and/or not COM libraries.
This link might help with locating the propper .dlls:
(copy/paste from linked post:)
What you need to do is add the correct DLLs as references to your
project. Since they are not in the list, you'll have to add them
manually. I am assuming you are using the October SDK?
What you'll need to do is:
Right-click on References folder, and select "Add Reference..."
On the .NET tab, select the "Browse" button.
Navigate to where you installed the SDK. (On my machine it is C:\Program Files\Microsoft DirectX 9.0 SDK)
The files you are looking for should be in ".\Developer Runtime\x86\DirectX for Managed Code"
Select the DLLs that you want (in this case Microsoft.DirectX.dll, Microsoft.DirectX.DirectInput.dll)

how to include XNA libraries in C# project?

I am trying to make a C# game. I want to include XNA libraries there (e.g. Microsoft.XNA.Framework.Graphics). But, if I do so, I get an error :
The type or namespace XNA doesnot exist in the namespace Microsoft.
Can anyone please help ?
First of all, check you are using the correct case, the namespace and assembly names are Xna not XNA. If that doesn't work:
You should follow the instructions here. These describe how to install (as well as some flavour of Visual Studio 2010) XNA Game Studio and to create a project using the template. Using the template project is much easier than adding the references manually.
To add a reference to the XNA assemblies, you need to right click your project in Solution Explorer in Visual Studio and select "Add Reference".
If you do not see the DLLs you are looking for, you may need to right click your project, select properties, and then ensure that the target framework is one of the flavours of the .NET 4.0 framework (for XNA 4.0).
First you should right click on the "References" folder shown (usually) at the top of the project you are working in. From here you can select add references and manually browse to the location of the XNA .DLLs.
First, you need to add a reference to the XNA binary files. Second, I recommend you start off with the Built-In Visual Studio XNA Game Template, and work from there.
To add the references manually, you'll (probably need XNA Game Studio installed) and then add references to Microsoft.Xna.Framework.dll and whatever else you need.
Personally, I still think you should start with the built-in visual studio template for a Game. Once you get a feel for it, move on to advanced concepts like embeding your game into a standard WinForm app or whatever.
In the solution explorer. Go to reference, add reference and then add th Microsoft.Xna.Framework.Xact reference 4.0 It is somewhere near the bottom if you leave it unsorted. Then you can access the Audio Engine class.
I had the same problem and then found it at the 3rd time of trying. Worked fine for me. Hope this helps.
Instead of hassling around in the references list in Visual Studio, just download the DLL from HERE, or the direct link:
https://www.dllme.com/dll/files/microsoft_xna_framework_dll.html

Categories