2

I am using Visual Studio Community 2015 RC. I have created an ASP.NET 5 / MVC 6 project.

Now I want to add a (.NET) DLL to the project but if I open the dialog “Add Reference...” I am not able to browse any folders outside the solution. The browse button is missing.

Is there any other way to add a reference to the project at compile time?

A class library (as a NuGet package) is not a solution because here is the same problem. If I create, say, a WPF application the browse button is available.

2

3 Answers 3

4

In order to Add additional dll or third party dll in MVC6 please follow below steps.

  1. you may create nuget package of the dll by "Nuget Package Explorer".
  2. Now you need to add a location for the nuget package (In order for Best practices we should create a folder at solution location). In Visual Studio Go To Tools > Options > Nuget Package Manager > Package Sources > click on "+" button > select location by browsing and click update > press ok button.
  3. Next, in Solution explorer right click on reference > Manage Nuget Packages > select Package source which you have created earlier and install it.

Now you will be able to find it under DNX 4.5.1

Sign up to request clarification or add additional context in comments.

1 Comment

This worked like a charm. And is much better than my approach.Thank you.
0

Not sure how are you going to add reference to assembly dynamically if you haven't loaded it yet. But you can just load your assembly from a file with :

Assembly.LoadFrom("MyAssembly.dll");

2 Comments

This is adding the dll at runtime, but I want to add the dll to the project.
Yes but is it possible at all ? You can use early binding and late binding and there is no such option like 'late-early binding'...
0

The following procedure worked for me:

Add a new project for creating a (classic) C# class library (.dll) to the solution.

Add the external DLLs to the class library project by right clicking on “References” and then select “Browse…”. Find and add the DLLs to the class library project.

Reference the class library in the web project by right clicking on “References”, select “Projects” and then “Solution”.

The Packages of the web project are restored and the project.json is modified automatically.

  "frameworks": {
    "dnx451": {
      "dependencies": {
        "ClassLib1": "1.0.0-*"
      }
   }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.