dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.91k stars 4.63k forks source link

.NET 5.0 application installed by ClickOnce may fail to start after being installed #44602

Closed worldofsites closed 3 years ago

worldofsites commented 3 years ago

Entry in the Windows Application Event Log after app start:

  An assembly specified in the application dependencies manifest (TestApp.deps.json) was not found:
    package: 'System.ServiceModel.Primitives', version: '4.7.0'
    path: 'lib/netcoreapp2.1/System.ServiceModel.dll'

What in TestApp.deps.json:

      "System.ServiceModel.Primitives/4.7.0": {
        "dependencies": {
          "System.Private.ServiceModel": "4.7.0"
        },
        "runtime": {
          "lib/netcoreapp2.1/System.ServiceModel.Primitives.dll": {
            "assemblyVersion": "4.7.0.0",
            "fileVersion": "4.700.19.56502"
          },
          "lib/netcoreapp2.1/System.ServiceModel.dll": {
            "assemblyVersion": "4.0.0.0",
            "fileVersion": "4.700.19.56502"
          }
        }
      },

Related dependencies:

  <ItemGroup>
    <PackageReference Include="Microsoft.PowerShell.Commands.Diagnostics" Version="7.1.0" />
    <PackageReference Include="Microsoft.PowerShell.Commands.Management" Version="7.1.0" />
    <PackageReference Include="Microsoft.PowerShell.Commands.Utility" Version="7.1.0" />
    <PackageReference Include="Microsoft.PowerShell.ConsoleHost" Version="7.1.0" />
    <PackageReference Include="Microsoft.PowerShell.CoreCLR.Eventing" Version="7.1.0" />
    <PackageReference Include="Microsoft.PowerShell.MarkdownRender" Version="7.1.0" />
    <PackageReference Include="Microsoft.PowerShell.Native" Version="7.1.0" />
    <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.1.0" />
    <PackageReference Include="Microsoft.PowerShell.Security" Version="7.1.0" />
    <PackageReference Include="System.Management.Automation" Version="7.1.0" />
  </ItemGroup>
davidfowl commented 3 years ago

@richlander where do issues like these go?

AndriiPrystai commented 3 years ago

I have similar issue. My app is packed into Windows Installer (WiX toolset). After migration to .NET 5, installer fails to start an app. EventViewer entry:

Description: A .NET application failed.
Application: *******.exe
Path: C:\Program Files\*******\*******\*******.exe
Message: Error:
  An assembly specified in the application dependencies manifest (*******.deps.json) was not found:
    package: 'runtimepack.Microsoft.NETCore.App.Runtime.win-x64', version: '5.0.0'
    path: 'createdump.exe'

[2020-11-13 update] Issue resolved. Details: WiX toolset project has a custom filter that excludes appsettings* and *.exe files from publish directory except the main app executable. .NET 5 includes a new tool createdump.exe (Microsoft .NET Runtime Crash Dump Generator) on publish. After I whitelisted createdump.exe - an app is properly installed and launched.

Pilchie commented 3 years ago

@NikolaMilosavljevic - do you know where this should go?

NikolaMilosavljevic commented 3 years ago

@NikolaMilosavljevic - do you know where this should go?

It seems that this is not ClickOnce specific - I'd suggest dotnet/runtime to start.

Dotnet-GitSync-Bot commented 3 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

richlander commented 3 years ago

@worldofsites -- does this only happen when you deploy with ClickOnce?

worldofsites commented 3 years ago

@richlander yes, only when deploy with ClickOnce. Also, I see these errors not only when I'm using Microsoft.PowerShell libraries. For example, when I have System.Data.SqlClient dependency I see the following error in Windows Application Event Log:

Message: Error:
  An assembly specified in the application dependencies manifest (Dummy.deps.json) was not found:
    package: 'runtime.win-x64.runtime.native.System.Data.SqlClient.sni', version: '4.4.0'
    path: 'runtimes/win-x64/native/sni.dll'

Microsoft.Data.SqlClient:

Message: Error:
  An assembly specified in the application dependencies manifest (Dummy.deps.json) was not found:
    package: 'Microsoft.Data.SqlClient.SNI.runtime', version: '2.0.1'
    path: 'runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.dll'
richlander commented 3 years ago

Is the app published as framework-dependent of self-contained? Also, do you publish in terms of a runtime (like -r win-x64)?

worldofsites commented 3 years ago

@richlander We've do some tests: 1) Framework-dependent (win-x86/win-x64/Portable) ClickOnce publish success, install app success, trying to run app - same error: path: 'runtimes/win-x86/native/Microsoft.Data.SqlClient.SNI.dll' path: 'runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.dll' path: 'runtimes/win/lib/netcoreapp3.1/Microsoft.Data.SqlClient.dll'

2) Self-Contained (win-x86/win-x64) ClickOnce publish success, install app success, trying to run app - same error: path: 'runtimes/win-x86/native/Microsoft.Data.SqlClient.SNI.dll' path: 'runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.dll'

3) Framework-dependent (singlefile + win-x86/singlefile + win-x64) Works! 4) Self-Contained (singlefile + win-x86/singlefile + win-x64) Error on publish:

The "GenerateBundle" task failed unexpectedly.
System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath
   at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs)
   at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore()
   at Microsoft.NET.Build.Tasks.TaskBase.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
ghost commented 3 years ago

Tagging subscribers to this area: @vitek-karas, @agocke See info in area-owners.md if you want to be subscribed.

Issue Details
Description: Entry in the Windows Application Event Log after app start: ``` An assembly specified in the application dependencies manifest (TestApp.deps.json) was not found: package: 'System.ServiceModel.Primitives', version: '4.7.0' path: 'lib/netcoreapp2.1/System.ServiceModel.dll' ``` What in TestApp.deps.json: ``` "System.ServiceModel.Primitives/4.7.0": { "dependencies": { "System.Private.ServiceModel": "4.7.0" }, "runtime": { "lib/netcoreapp2.1/System.ServiceModel.Primitives.dll": { "assemblyVersion": "4.7.0.0", "fileVersion": "4.700.19.56502" }, "lib/netcoreapp2.1/System.ServiceModel.dll": { "assemblyVersion": "4.0.0.0", "fileVersion": "4.700.19.56502" } } }, ``` Related dependencies: ``` ```
Author: worldofsites
Assignees: -
Labels: `area-Host`, `untriaged`
Milestone: -

John-Hart commented 3 years ago

The missing assembly is being installed by ClickOnce but, it is in the same folder as the application. As was pointed out already, it does not match the relative path that is in the dependencies manifest (*.deps.json).

We have a Visual Studio issue tracking this issue: https://developercommunity2.visualstudio.com/t/A-NET-Core-31-or-NET-50-application-/1248873

The GenerateBundle build issue when Self-Contained Single File is selected, is being tracked here: https://developercommunity2.visualstudio.com/t/The-GenerateBundle-task-failed-unexpec/1257409

ctaggart commented 3 years ago

I experimented with ClickOnce and .NET 5 this weekend. I can confirm @worldofsites said on Nov 12th, if native dependencies are involved, single file apps that are framework dependent is the only thing that works. I attempted to publish MSBuildStructuredLog as ClickOnce to GitHub pages. It is using Aavalonia libraries which depend on native libraries. I reproduced the issue by create a new project with dotnet new avalonia.app -o AvaloniaApp1, updating the dependencies to latest, removing unused imports, and then trying ClickOnce.

John-Hart commented 3 years ago

Thanks @ctaggart for taking the time to provide us with this feedback.

We're tracking this issue also as part of this Visual Studio issue: https://developercommunity2.visualstudio.com/t/A-NET-Core-31-or-NET-50-application-/1248873.

vitek-karas commented 3 years ago

@John-Hart https://developercommunity2.visualstudio.com/t/A-NET-Core-31-or-NET-50-application-/1248873 has been closed. Does it mean we can close this one as well?

agocke commented 3 years ago

Closing, as this is a ClickOnce issue and the runtime is behaving as designed.