0

I created a class library in .net core and and hosted class library on my local nuget server.Class library contains controllers and some other classes to be used by reflection.

I consumed this class library in my asp.net core MVC project.By installing it as nuget refrence. Now my MVC project builds well but at runtime I am not able to find my contoller or other classes defined in class library.

weird behavior when I copy dll of my class library to my MVC projects bin\Debug\netcoreapp1.1 directory, reflection starts working.

this is happening when i run my application in debug mode on IIS Express and I am using .net core 1.1 on Visual studio 2015

Question: Is there a way to extract nuget packages in to bin\Debug\netcoreapp1.1 on build. Question: Do I need to added some configuration so that Reflection look for dll in respective nuget package location.

1 Answer 1

0

Have a look at this answer, it might cover what you are looking for.

https://stackoverflow.com/a/38252635/138029

UPDATE: You could try adding a NuGet.config file to your project root.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <packageSources>
   <add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
   <add key="NuGet" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
   <add key="Local" value="[PATH_TO_YOUR_NUGET_PACKAGES]" />
  </packageSources>
</configuration>

As an aside, if the directory is local to the project root you can commit those local packages to the Source Control. This allows build tools like Visual Studio Team Services to reference them automatically when they build.

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

3 Comments

My case is bit different that above case . Dll I reference are never copied to bin\Debug\netcoreapp1.1 ,they are placed in C:\Users\myaccountname\.nuget\packages. As dll are never copied to bin\Debug\netcoreapp1.1 reflection could not locate them.
Do you have a nuget.config that references that package folder?
there is project.json in asp.netcore no nuget.config file

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.