question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.Net Core 2.0 SDK causes ASP.Net 1.1 Web App with project references to break

See original GitHub issue

After I installed the .Net Core 2.0 SDK I started getting an InvalidOperationException: Can not find assembly file Microsoft.CSharp.dll at 'C:\Projects\Temp\VS2017Issue\WebApplication1\bin\Debug\net462\refs,C:\Projects\Temp\VS2017Issue\WebApplication1\bin\Debug\net462\ error at runtime on a web application that references a class library project.

If I remove the class library project reference then the runtime error goes away.

Falling back to the .Net Core 1.0.4 SDK (uninstall 2.0 or use global.json to target 1.0.4) also fixes the issue.

I have a sample app that reproduces the issue at https://github.com/squareitechnologies/VS2017Issue

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:26 (14 by maintainers)

github_iconTop GitHub Comments

11reactions
dasMullicommented, Aug 16, 2017

I believe this may be an issue of new logic to generate the deps.json file requiring a new version of Microsoft.Extension.DependencyModel that include https://github.com/dotnet/core-setup/commit/35749847a0fa555e2c758da17f52b6eaef2164be (or some other change).

Adding a reference to the new NuGet package for the ASP.NET Core 1.1 app resolves the issue in @jeffpapp’s example project on my machine:

<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.0.0" />

cc @eerhardt

1reaction
nemancommented, Aug 18, 2017

I managed my project to build with SDK 1.0.4 after commenting this out in file Microsoft.NET.Build.Extensions.NETFrameworks.targets

<!-- prevent using an older SDK version with NETStandard2.0 references --><!--
    <PropertyGroup>
      <_UsingOldSDK Condition="'$(UsingMicrosoftNETSdk)' != 'true' AND ('$(TargetFramework)' != '' OR '$(TargetFrameworks)' != '')">true</_UsingOldSDK>
    </PropertyGroup>
    <NETBuildExtensionsError Condition="'$(DependsOnNETStandard)' == 'true' AND '$(NETStandardInbox)' != 'true' AND '$(_UsingOldSDK)' == 'true'" ResourceName="UnsupportedSDKVersionForNetStandard20"/>-->

although I do not think it is a smart move.

UPDATE: Silly me, I just added <DependsOnNETStandard>netstandard1.6</DependsOnNETStandard> as @TomGroeneboer wrote. Works perfect for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrate from ASP.NET Core 1.x to 2.0
This article outlines the prerequisites and most common steps for migrating an ASP.NET Core 1.x project to ASP.NET Core 2.0.
Read more >
Netcore 2.1.1 release leads to app failing to run
Web.csproj : error NU1107: Version conflict detected for Microsoft.AspNetCore.Antiforgery. Reference the package directly from the project to ...
Read more >
Please stop lying about .NET Standard 2.0 support!
In this post I have a bit of a rant about Microsoft's NuGet packages lying about supporting .NET Standard 2.0 when they kinda...
Read more >
Upgrading to .NET Core 2.0 Preview - Rick Strahl's Web Log
Changing the target of the Web API project to .NET Core App 2.0; In the Web Project adding a reference to Microsoft.AspNetCore.All; In...
Read more >
.NET core vs .NET framework
Wondering about the difference between .NET Core & .NET Framework? Here's a quick guide on how to pick the right runtime environment for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found