-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.Net Core 2.0 SDK causes ASP.Net 1.1 Web App with project references to break #1488
Comments
Even more fun, if you try to target the
Which is to be "fixed" by setting Might be another issue, might not be, but I saw it after I "fixed" (a.k.a. worked around) the |
@TomGroeneboer did you install the 2.0.0 SDK? (https://www.microsoft.com/net/download/core). |
@dasMulli Yes I did.
|
@TomGroeneboer and @dasMulli Did you add That might at least get me in a mode where I can build and run in VS2017.3 |
@jeffpapp Oh, yeah right, you're targeting netstandard1.5 :) I've added the |
AFAIK the error is expected for the 1.* SDKs since they really don't have support to add the required compatibility assemblies to netfx projects that target .net standard versions. (Note the two lines for .net framework support in the table at https://docs.microsoft.com/en-us/dotnet/standard/net-standard) However, that is a different issue than the missing |
@dasMulli True, they do not have to support the scenario we have. However, the 2.0 SDK does and that is indeed a bug. My 'fix' is just a workaround until MS fixes the issue. |
I believe this may be an issue of new logic to generate the deps.json file requiring a new version of 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 |
@dasMulli That worked for me too in both my sample and real apps. So this is caused by the 2.0 tooling creating a different deps.json file than what the 1.1 runtime was expecting? And then manually adding that NuGet package updates how the 1.1 runtime deals with the new deps.json file? I'm trying to understand what's happening so I can decide if I want to use the upgraded package in our production 1.1 app, or maybe wait for a fix of some kind to the 2.0 tooling if that would be possible. |
I agree with what @natemcmaster wrote:
But this is exactly what happened. As long as there is no breaking API change using the |
I quickly looked into this issue and here is my analysis: In the 2.0 tooling, we made a change to copy reference assemblies into the 'refs' folder even during The place this broke was an assumption that code in DependencyModel v1.x makes var refsPath = Path.Combine(_basePath, RefsDirectoryName);
var isPublished = _fileSystem.Directory.Exists(refsPath);
...
// throw in case when we are published app and nothing found
// because we cannot rely on nuget package cache in this case
if (isPublished)
{
throw new InvalidOperationException(
$"Can not find assembly file {assemblyFile} at '{string.Join(",", directories)}'");
} It assumes that if a This assumption was changed in DependencyModel v2.0, which is what @dasMulli calls out above. So referencing 2.0 DependencyModel is a valid workaround for this issue. Or continue using the 1.x SDK in a global.json will also unblock you, like you did in the repro repo: https://github.com/squareitechnologies/VS2017Issue. |
Are there any downsides with using 2.0 DependencyModel with other 1.1 packages? Or should everything work correctly with the newer DependencyModel? |
This may be a candidate for an LTS fix for This is not a requirement for us since we plan to update everything to 2.0 asap, but it would be interesting to hear what other users want/need. |
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: |
I started hitting the same issue as @TomGroeneboer (and as it seems many others) after updating to 15.3 and installing the .net core 2.0 sdk: |
/cc @nguerrera @dsplaisted - for help with the
error. @TomGroeneboer and @xenry - maybe a separate issue should be opened for this, as it is a separate problem than what this issue was logged for. |
@xenry try to add |
cc @ericstj There is https://developercommunity.visualstudio.com/content/problem/93342/cant-downgrade-to-lower-net-core-sdk.html, but no issue on GitHub yet. |
Let's discuss SDK 1.x vs netstandard1.5/1.6 refs at #1527 or on the developercommunity thread and stick to the original issue of .NET Core 2.0 SDK causing runtime failure in 1.1 app here. |
Getting back to the original issue, the options I see are:
|
Similar issue: #1524, though not related to netfx |
I'm not sure
will work correctly. @nguerrera (or @ericstj and @dsplaisted) would know more than me as I think this change came in while I was out. Even #1272 made it so "Copy any Reference that can't be resolved at runtime to the build output "refs" folder.". I think these My opinion is we should do a hybrid of (2) and (1) above. I'm not aware of any reason the 2.0 DependencyModel won't work with a 1.1 app. So for now, I recommend people running into this issue either use the 1.x SDK, or upgrade DependencyModel to 2.0 (or upgrade to netcoreapp2.0 completely if they want/can). But I also think we should backport the change into 1.1.x of DependencyModel. I've logged https://github.com/dotnet/core-setup/issues/3081 to make the DependenyModel change. |
I am going to close this issue since it seems the suggested approaches are all around DependencyModel:
If I misunderstood something, please, comment and I can re-activate this issue. |
The issue is still persists (appeared again?) for both .NET Core SDK 1.1.8 & 2.1.101 Target startup project to net4xx only and reference netstandard1.6 library having no netxxx targets (which is library dependent, I can try to provide isolated example). Whole build process for a project is broken at this point, and project mentioned in error has nothing to do with real issue. Sometimes error(s) appears in cases where is no real issue with project mentioned in error text, which is misleading and cause issues with future investigation. If you force project to have reference Is it a hard override for updated SDKs (seems both 1.1 and 2.1) to force facade libraries to reference netstandard2.0? The further you get, the harder the going. |
@multiarc Since this issue is closed, and I'm not sure whether or not you're encountering the same root issue anyway, can you file a separate bug, and try to include repro steps? Thanks |
If someone else runs into this problem...we ran into it after updating VS to 15.8. Updating Microsoft.AspNetCore to >= 1.1.7 and Microsoft.AspNetCore.Mvc to >= 1.1.8 fixed the problem on our side. |
…0200601.11 (dotnet#1488) Microsoft.AspNetCore.Analyzers , Microsoft.AspNetCore.Components.Analyzers , Microsoft.AspNetCore.Mvc.Api.Analyzers , Microsoft.AspNetCore.Mvc.Analyzers From Version 5.0.0-preview.6.20279.12 -> To Version 5.0.0-preview.6.20301.11 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
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
The text was updated successfully, but these errors were encountered: