Can't Add Reference to Visual C# Console App in Visual Studio - c#

I have created a Visual C# Console App and I am trying to add reference to resolve an error. Since I am new to the IDE and I am looking for some help on how to add the Reference via the editor. I am trying to connect to Azure Storage via this app.
Attaching the screen shot.
I used the general resolution saying
In Solution Explorer, double-click the My Project node for the
project.
In the Project Designer, click the References tab.
But I am not seeing the References tab to add Reference.

Thanks for help. First place I was supposed to create a 'Console App (.Net Framework' instead I mistakenly chose Console App (.NET Core). Now I am ble to see the Refrences.
Thanks for the help.

First of all switch the Solution Explorer view by clicking button in the header as shown in the below image:
After that you will find the "References" node in the tree. Right click and then choose Add Reference
References:
Managing references in a project
How to: Add or Remove References By Using the Add Reference Dialog Box

If you want to use .NET Core (.NET) instead of .NET Framework, just install this package in PM:
PM> Install-Package System.Configuration.ConfigurationManager -Version <YourCompatibleVersion>

Related

Xamarin Forms, Remove WinPhone Target Platform on Visual Studio

Currently I am trying to add service reference for mine Portable Class Library (PLC) in my Xamarin.Forms apps. For that point, I read that I have to remove Windows Phone 8.1 target platform.
I am opening PLC properties and I see where the target platforms are, there I find WinPhone and Silverlight, unfortunately when I click Change they disappear and I cannot remove them.
Screenshot of libraries
Can anybody suggest what the issue could be and how can I fix it?
Please keep in mind that I am doing it with Visual Studio Community 2017 (version 15.2).
Thanks in advance
1 option is to change the .net profile version manually in your .csproj file.
Visual Studio unload your current PCL Project.
Edit your .csproj File (Right Click on the unloaded project)
Find Node <TargetFrameworkProfile></TargetFrameworkProfile>
Change Value to Profile7
Save and close the file.
And than reload your .csproj file.
Another way is to uncheck Asp.Net Core when clicking on Change button. That will give you the Add ServiceReference instantly.

Unable to add project reference in Visual Studio 2015

I previously asked a similar question regarding Visual Studio 2013 but now I'm running into the same problem with Visual Studio 2015 but it seems to work differently, which makes the previous answer not applicable to this question. This is my previous question: Visual Studio 2013 - How to debug a project within a solution
I'm attempting to add a project reference. I have a library I'm working on in a separate solution/project and a console application I want to use to test and debug the library.
I tried: Add Reference > Projects > Solution > Browse
But the open file dialog does not contain .sln files in the filter list and if I force it to display them by typing *.sln and then select the Solution I get:
"Please make sure the file is accessible and that it is a valid assembly or COM component."
What am I doing wrong? How do I properly add a Solution/Project reference?
For me issue was due to difference in Target framework. One was .NET Framework 4.5 and other was .NET Framework 4.5.2
Verify if the Target framework is same for your project and the project reference that you are trying add reference.
(Right click on project -> properties -> Application Tab(Target frame work))
Right click on your solution file in Solution Explorer window, click Add and select Existing Project...
Once the project is a part of the solution, you will be able to add project reference.
In case anyone else runs into this here is something that I found. I had almost the exact same issue in VS 2015. I created a console app and then a class library project but could not add a reference to the class library.
It turns out I didn't create a class library project as I had thought, but rather a class library (package) project. These are different things and I was unaware of what the (package) part meant when I selected it. This is for creating Nuget packages, apparently.
I'm not sure if this is something new to VS 2015 but I had not run across it before and it caused me some grief. The error message ('A reference to ClassLibrary1 could not be added') was totally worthless in trying to debug it.
You should add project to your solution first; after adding project to your solution, you can reference it.
To add an existing project to your solution:
Add reference menu:
Add references dialog:
In order to add a project reference, the project has to be part of the solution.
For me issue was due to a difference in the types of projects. One was a C# Windows forms project and the other project was a C# Universal Windows project.
The Windows Forms project couldn't reference the Universal Windows project. The error was "Unable to add a reference to project "XYZ".
It appears you can have a library shared between both types of projects by folloing this answer: What kind of class library works with both Universal and Winform projects?
I ended up having a different solution. I had three projects in the solution which referenced a NuGet package which was no longer available. I had the library locally but I was unable to add it. I found that because of the BUILD ORDER and DEPENDENCY of my projects, I had to add it to the project that was built first, then I could add it to the projects that were dependent on that project.
I had this problem today and I looked at the configuration manager for the solution. The projects had different platform settings. I made them both Any CPU and rebuilt. Then I could reference the project.

Visual Studio 2015 - Adding Reference to class library C# ASP.NET

I am trying to add references to class libraries under my Web Forms solution. I added several class libraries to the main solution (via File -> New Project -> Add to solution). When I tried to add references to them (both from the solution explorer window and the File menu), I received a popup stating simply: "Cannot add reference to ," with no additional error messages.
I verified that all projects are using the same version of the .NET Framework (4.5, NOT the client version) and the same target architecture (x64), as I have seen in other Stack Overflow posts.
I did try and add the reference via browse, and added the DLLs from the /bin/debug folder, and that actually worked. The namespaces were picked up and even shown in intellisense. My concern here is breaking these references during release builds and deployments.
I found a workaround for this problem.
When you head over to your solution and add a new project, you'll automatically be directed in the Web category. Instead head over to the Windows tab and pick that Class Library instead.

Which DLL has the Windows.Devices.Gelocation namespace?

I'm using VS 2012 and I need to write code that uses the classes in the Windows.Devices.Gelocation namespace. I downloaded the sample program but it won't load in VS2012 as it requires VS 2013. And the documentation for the class does not indicate which DLL that namespace is in.
Can someone tell me which DLL contains that namespace? Is it available in .NET 4 or do I have to use .NET 4.5?
Edit
My project is a console application which runs in the background as a Windows service. The searching I've done indicates that I have to target Windows 8 by using the Reference Manager's Windows Tab. But there is no Windows tab in the Reference Manager in my project because it's not a Windows Store application. Is there a way to use this API from a desktop application???
I've found how to reference the assembly I need.
On this page, under the section Windows Tab, in the Core Subgroup subsection, the third paragraph gives instructions on how to reference the needed windows assemblies from desktop applications. To summarize it:
Unload the project to which the reference will be added.
Edit the .csproj file for the project.
Add the following snippet anywhere in the .csproj file:
<PropertyGroup>
<TargetPlatformVersion>8.0</TargetPlatformVersion>
</PropertyGroup>
Save the edited .csproj file.
Reload the project.
At this point, when you open the Reference Manager dialog, you'll see a Windows tab on the left. Click that, and you'll see the Core subgroup. To the right, it'll say "Targeting Window 8.0" and under that "Windows version 255.255.255.255" will be unchecked. Check it off then click OK & you're done.

How do you add a DLL reference to a .NET WebAPI project?

I am using Visual Studio 2012 and .NET 4.5 and the new WebAPI project type. However, I am unable to add a reference to my class library project to the WebAPI project. Does this need to be a "portable class library" project or can it be a regular one? There's no error, it just doesn't get added!
Alrighty so in Visual Studio 2012 there's a check box next to each reference you want to add, in the add references menu.
It's very non-intuitive. We've gone away from selecting things by highlighting and have moved to check boxes.

Categories

Resources