Can't reference dll assembly to the Visual Studio Code project - c#

I am developing a console application in C# which requires some dll file to be referenced in Visual Studio Code(not Visual Studio!). There is no such option in menu I guess and I even tried Nuget package manager, but it does not worked for me. I cannot find any tutorial regarding this. Any experienced user?

You can use dotnet-add reference CLI command which provides a convenient option to add project references to a project.
Example: Add a project reference:
dotnet add app/app.csproj reference lib/lib.csproj
For more information, refer this.

Related

How to view the source code from downloaded packages in Visual Studio

I am working on TOTP and have downloaded a package in Visual Studio 2013 by:
Tools --> Library Package Manager --> Manage Nuget Package Packages
However there seems to be no documentation for this downloaded package. So is there anyway I can view all the code and implementation in this package in order for me to know how to use the classes in the package?
After including the package:
using Albireo.Otp;
using Albireo.Base32;
I can go to the definition from the classes within the package by
right clicking the class --> Go To Definition.
But is there a way to view all the files and implementations from this downloaded package?
For that specific library, the source is at https://github.com/kappa7194/otp
To answer your question, You can either use Assembly Explorer or Object Browser in VS.
Go to Solution Explorer -> Open references --> Right click on the referenced library
Im using VS 2016 not sure if VS 2013 has that feature.

Reference not working in Visual Studio 2012

I have a simple console application that is supposed to use Newtonsoft.Json to desrialize JSON objects.
I installed Newtonsoft.Json via Manage Nuget for Solution and the package shows as installed in Nuget however the reference is not showing at all in the project or in the file .csproj.
Any clue?
Maybe you should add a reference to the library. Project->Add reference, find package you need and press ok. Then you can include this package to your project with keyword using.

Adding a NuGet package to a project without Visual Studio

I'm trying to automate adding NuGet packages to project on a remote server that doesn't have Visual Studio (nor any build servers) installed. I do know how to use NuGet.exe from my C# code, but this executable only downloads packages and doesn't do any other required work (adding references, executing ps scripts etc). What do I do in order to fully install a package?
Note: I don't need to update a package for my own app, I need to add a package to an arbitrary .csproj file on the server. I'm building a Web-based .Net IDE, and need my users to be able to add packages to their projects.
I see two possibilities: one is using some kind of functionality not present in NuGet.exe, but ratherin some other library (maybe a VS addin), but I don't know where to look for it. The other is to simulate some kind of NuGet Powershell console and send commands to it, but again, I don't know how to do that.
You might want to consider SharpDevelop.
Installing NuGet Packages outside of Visual Studio an article about the functionality you are trying to achieve (written by Matt Ward, one of the project contributors) says:
Since NuGet uses PowerShell the simplest approach was to extend the
existing PowerShell cmdlets included with SharpDevelop. Now you can
write a few lines of PowerShell script to install a NuGet package into
a project that has never had a NuGet package before, have the project
itself updated and any package PowerShell scripts run. All this from
the command line without Visual Studio open.
Just to add an additional answer in-line with Alex's post about SharpDevelop, you have a couple different options.
Use Nuget.exe (Related Blog post)
NuGet Addin for MonoDevelop and Xamarin Studio (see GitHub)
ASP.NET Pages using WebMatrix (see this video)
All of this info is from the Nuget FAQ.

How to reference a C# Class Library project in Visual Studio 2010?

I am new to visual studio and was wondering how to setup visual studio 2010 so that I can reference my C# windows class library project? I currently have a solution with 2 projects - C# library project and a unit test project.
What is the best way to create multiple clients that will use this library? Should they be their own solution or just another project in the library solution? How do I use the classes in the library function from the project that references the library project?
You can add a reference to a library by doing a rightclick on the references node in the solution explorer and selecting the req. lib...
When all you consuming apps are located within the same solution I would prefer to place the lib also inside the sln, otherwise I would use an extra sln
Right click on the Client project "References" - > Add Reference
Go to the Projects tab if the class library is in the same solution. Else Browse and select the dll of the class library.
If Class library is not going to release as common dll for multiple projects, it's better to add them all to the same solution.

referencing System.Windows.Automation

I wanted to try out some of the automation stuff available through BugSlayer, but am having problems with the references.
I'm trying to figure out how to reference the System.Windows.Automation library in visual studio. I have the .NET Framework v3.5 installed, and VS 2008, but neither the UIAutomationClient nor System.Windows.Automation appear as a reference option in either the .NET or COM tabs for the references.
I can see the dll if I navigate to C:\WINDOWS\assembly\GAC_MSIL\UIAutomationClient\3.0.0.0__31bf3856ad364e35 through the command prompt, but if I browse to the assembly in Visual Studio, I can't actually get to the dlls.
Have I overlooked a simple way to include this in my project?
The UIAutomationClient.dll is located in this folder:
C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0
If you can't find in your Add Reference->.Net tab, then you have to use the Browse tab to go to the given path, and add the assembly (Right Click on the References, choose add reference, click browse tab).
add Uiautomationclient dll present under .net tab
I'm using Visual Studio Express 2015, and targeting to .NET 4.5. None of the answers worked for me. Here's what I had to do (after many minutes of looking through Add References -> Assemblies -> Framework and playing around. The reference I added is "UIAutomationClient". (There isn't any System.Windows.Automation" assembly in my list. Note that I also see assemblies "UIAutomationProvider", "UIAutomationTypes", and "UIAutomationClientsideProviders", but I didn't try any of those.)
Anyway, once I got the reference to "UIAutomationClient" added, then the using System.Windows.Automation actually worked okay.
For .Net coreapp 3.1, my fix is adding UseWPF into PropertyGroup of csproj file.
<UseWPF>true</UseWPF>
In VS 2015, you need to reference the UIAutomationProvider dll to use this Provider namespace. Just add a reference to this dll in your references folder. It's available in the Framework Assemblies of .NET.

Categories