3

I have an ASP.NET Core 2.0 Razor Pages project. I am using Visual Studio 2017.

I have added one of our in-house assemblies to the project (it contains common definitions, types and functions etc). The project compiles but when I attempt to run it I get the following error.

enter image description here

Here is my .csproj file

<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.0</TargetFramework> <Version>2018.3.12.6</Version> </PropertyGroup> <ItemGroup> <PackageReference Include="JWT" Version="3.1.1" /> <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" PrivateAssets="All" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" PrivateAssets="All" /> </ItemGroup> <ItemGroup> <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" /> <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" /> <DotNetCliToolReference Include="dotnet-setversion" Version="*" /> </ItemGroup> <ItemGroup> <Reference Include="Common"> <HintPath>..\packages\Common.dll</HintPath> </Reference> </ItemGroup> </Project>

Here's my Visual Studio 2017 project showing the assembly in the project.

enter image description here

Googling the error doesn't provide much useful information.

How do I add a reference to a custom assembly in an ASP.NET Core 2.0 Razor Pages project?

2
  • Did you tried stackoverflow.com/questions/46279561/… ? Commented Mar 19, 2018 at 14:45
  • Yes I saw that post. The accepted answer is MVC related. I'm not using MVC. My project is a Razor Pages project. Commented Mar 19, 2018 at 14:53

2 Answers 2

2

I fixed the same issue by installing Microsoft.Extensions.DependencyModel, version 2.0.3.

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

Comments

0

The solution to the problem has been posted here https://github.com/dotnet/core-setup/issues/2981

See the top comment (by tuespetre) and then the update just further down (also by tuespetre). This worked for me.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.