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.
Related
I'm not sure when it disappeared, but I can't update my service references anymore, this is all new, I updated them like a month ago in a previous VS version without problems...
It's in a solution with a Xamarin Android project, the service references are in a .netstandard 2.1 project.
Also, if I try to add it manually from the Service References manager, weird errors pop up, and they don't make sense since using dotnet-svcutil is working:
We are experiencing this same problem in Visual Studio 2019 (16.11)
It is apparently fixed in an upcoming release. https://developercommunity.visualstudio.com/t/16110-update-service-reference-missing/1500425
This situation is common when I add references, delete references, and then re-add services with the same name. The type conflict seems to be caused by an old file that remains in a place where Visual Studio can still see it. All you need to do is clean it up before adding a new reference.
1.Delete the service reference in question.
2.Click the project name in the Solution Explorer to highlight the project.
3.Right-click the project reference.
4.Near the top of the context list, click Cleanup Items.
5.Add your service reference as usual.
Here is a similar example:https://github.com/dotnet/wcf/issues/3827
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>
I have a C# class library to make the works easier and I want to use it in my every project. So there must be an easy way to load it automatically as default on VS is opened and so I don't have to reference it again and again in my every project created. How can I do it?
If this project is stable version, you could add it to GAC like those .net framework dll. refer to below msdn article
https://learn.microsoft.com/en-us/dotnet/framework/app-domains/how-to-install-an-assembly-into-the-gac
Create a new project, add reference to above dll, and use File->Export Template --> Project to export a new project,
after that, restart Visual Studio, you should be able to see your own project template when you want to create new project.
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.
I have an issue with my project within Visual Studio that whenever I attempt to reference the Microsoft Visual Basic dll, none of the commands are showing or working within the project.
I've used the dll in projects before and I can't understand why it's not working in this one. I've referenced the dll using using Microsoft.VisualBasic; but whenever I want to use the Interaction.InputBox("Not Working"); command it's not showing or just gives me the error "The name 'Interaction' does not exist in the current context".
Am I being an idiot and missing something here or is there something else that is causing it to not work?
Any help?
You also need to add a reference to Microsoft.VisualBasic.dll:
https://support.microsoft.com/en-us/kb/325961
In a Visual C# application, click the Project menu, and then click Add Reference.
In the Component Name list, click Microsoft Visual Basic .NET Runtime to add Microsoft.VisualBasic.dll.
You can now use members of the Visual Basic .NET run-time library in Visual C#
In a Visual C# application, click the Project menu, and then click Add Reference.
In the Component Name list, click Microsoft Visual Basic .NET Runtime to add Microsoft.VisualBasic.dll.
You can now use members of the Visual Basic .NET run-time library in Visual C#
it works 4/03/2021