dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.7k stars 1.06k forks source link

RID inheritance does not work when publishing for net451+ #6045

Closed moozzyk closed 4 months ago

moozzyk commented 8 years ago

Steps to reproduce

Publish a web application for full desktop using non-win7-x* RID:

dotnet publish -f net451 -r win8-x64

The application will not have libuv.dll and therefore it will fail at runtime.

Expected behavior

Since there is not libuv for win8-x64 the one for win7-x64 should be published to the output.

Actual behavior

Because libuv.dll was not published the application fails with:

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.DllNotFoundException: Unable to load DLL 'libuv': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at Microsoft.AspNetCore.Server.Kestrel.Networking.Libuv.NativeMethods.uv_loop_size()
   at Microsoft.AspNetCore.Server.Kestrel.Networking.UvLoopHandle.Init(Libuv uv)
   at Microsoft.AspNetCore.Server.Kestrel.KestrelThread.ThreadStart(Object parameter)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.KestrelEngine.Start(Int32 count)
   at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Start[TContext](IHttpApplication`1 application)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host, CancellationToken token, String shutdownMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at Mvc.Server.Program.Main(String[] args)

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc2-002670)

Product Information:
 Version:     1.0.0-rc2-002670
 Commit Sha:  f0018642a9

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 RID:         win10-x64
{
  "compilationOptions": {
    "debugType": "portable",
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "dependencies": {
    "AspNet.Security.OAuth.GitHub": "1.0.0-alpha4-*",
    "AspNet.Security.OAuth.Introspection": "1.0.0-alpha1-*",
    "AspNet.Security.OAuth.Validation": "1.0.0-alpha1-*",
    "Microsoft.AspNetCore.Authentication.Google": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.Authentication.Twitter": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-*",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-*",
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0-rc2-*",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-*",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-*",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-*",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-*",
    "OpenIddict": "1.0.0-*"
  },

  "frameworks": {
    "net451": {
      "frameworkAssemblies": {
        "System.ComponentModel": { "type": "build" }
      }
    },

    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": { "version": "1.0.0-rc2-*" }
      },

      "imports": [
        "dnxcore50",
        "portable-net451+win8"
      ]
    }
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-*",
      "imports": "portable-net45+wp80+win8+wpa81+dnxcore50"
    }
  },

  "scripts": {
    "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
  },

  "content": [
    "wwwroot",
    "Views",
    "config.json",
    "web.config"
  ],

  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ],

  "publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc"
  ],

  "runtimes": {
     "win7-x64": {},
     "win8-x64": {}
  }
}
brthor commented 8 years ago

@moozzyk Is this a portable desktop app?

@pakrym Might this be related to the half portable work?

pakrym commented 8 years ago

@moozzyk post project.json please

dasMulli commented 8 years ago

I only get this behavior when i don't have "Microsoft.NETCore.Platforms" : "1.0.1-*" in my dependencies.

moozzyk commented 8 years ago

@pakrym - updated the report with project.json @brthor - I don't know what is portable desktop app vs. non-portable desktop app and how I express one vs. the other in the project.json.

pakrym commented 8 years ago

@moozzyk try adding "Microsoft.NETCore.Platforms" : "1.0.1-*" to common or net451 specific dependencies

moozzyk commented 8 years ago

After adding a dependency on "Microsoft.NETCore.Platforms" : "1.0.1-*" publish works even if runtime is not win7-x64

kevinchalet commented 8 years ago

Hum, I had not realized this dependency was required even for .NET Desktop (in my defense, the fact it has NETCore in its name is... misleading)

Would you recommend adding this dependency in a portable app that is supposed to work on both .NET Desktop and .NET Core? (the original project.json, that uses the portable model, can be found here: https://github.com/openiddict/openiddict-core/tree/dev/samples/Mvc.Server/project.json)

ibrmohammed commented 8 years ago

@moozzyk should we add the dependency "Microsoft.NETCore.Platforms" : "1.0.1-*" at the common level or at a framework level. Also please let me know for now if I can use the dependency change or publish it using win7-x64.

moozzyk commented 8 years ago

For now I would add "Microsoft.NETCore.Platforms" : "1.0.1-*" since this seems to fix the issue. I guess when this bug is resolved it will be clear whether you need to keep "Microsoft.NETCore.Platforms" : "1.0.1-*".

kevinchalet commented 8 years ago

@piotrpMSFT backlog? I'm pretty sure it's not coherent with what @davidfowl said earlier today about the fact this package won't be required for apps and that it should be fixed for RTM.

https://github.com/aspnet/Templates/issues/544#issuecomment-218216692

guardrex commented 7 years ago

@moozzyk Reviewing issues for Pub IIS. This seems like too much of an edge case to sweat for the Common Errors section (if even still a problem), correct?

moozzyk commented 7 years ago

@GuardRex - Correct, I don't think this belongs to common errors.

guardrex commented 7 years ago

yep ... not "common" enough for "common errors" :smile:

kevinchalet commented 7 years ago

@GuardRex @moozzyk isn't this "bug" fixed in RTM, anyway?

moozzyk commented 7 years ago

@PinpointTownes - I have not verified and the issue is still open so I assume it's not fixed.

guardrex commented 7 years ago

Yeah ... I was just going by lack of closure. I raised this b/c I'm reviewing Home, Hosting, IISIntegration, and ANCM repo issues for the Pub to IIS doc. I'm trying to review a lot of issues for this doc update.

Dykam commented 6 years ago

So this issue is still open, and while I assume the basic issue is fixed as I didn't encounter the issue for win*-x64, I did for win*-x64-corert, so I assume this is still topic is still relevant?

github-actions[bot] commented 5 months ago

Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label.

github-actions[bot] commented 4 months ago

This issue will now be closed since it has been labeled 'stale' without activity for 30 days.