dolittle-obsolete / DotNET.Fundamentals

Reusable, fundamental abstractions and building blocks
http://www.dolittle.io
MIT License
4 stars 8 forks source link

dotnet cannot build dolittle application "Could not load file or assembly Mvc.ViewFeatures" #258

Closed joelhoisko closed 4 years ago

joelhoisko commented 4 years ago
Ubuntu 19.04
.NET Core SDKs installed:
  2.2.402 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Trying to build a Dolittle application with dotnet build from the Source/*/Core folder fails with the following error message:

Microsoft (R) Build Engine version 16.2.32702+c4012a063 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 56.84 ms for /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Domain.Services/Domain.Services.csproj.
  Restore completed in 57.41 ms for /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Read/Read.csproj.
  Restore completed in 56.83 ms for /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Events/Events.csproj.
  Restore completed in 56.84 ms for /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Reporting/Reporting.csproj.
  Restore completed in 56.84 ms for /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Domain/Domain.csproj.
  Restore completed in 57.6 ms for /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Reactions/Reactions.csproj.
  Restore completed in 56.83 ms for /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Concepts/Concepts.csproj.
  Restore completed in 70.04 ms for /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Core/Core.csproj.
  Restore completed in 1.88 ms for /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Rules/Rules.csproj.
/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.targets(153,5): warning NETSDK1071: A PackageReference to 'Microsoft.AspNetCore.All' specified a Version of `2.2.0`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs [/home/joel/Dolittle/ProsjektLiv/Source/Pricing/Core/Core.csproj]
  Events -> /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Events/bin/Debug/netstandard2.0/Events.dll
  Concepts -> /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Concepts/bin/Debug/netstandard2.0/Concepts.dll
  Read -> /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Read/bin/Debug/netstandard2.0/Read.dll
  Domain.Services -> /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Domain.Services/bin/Debug/netstandard2.0/Domain.Services.dll
  Domain -> /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Domain/bin/Debug/netstandard2.0/Domain.dll
  Reactions -> /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Reactions/bin/Debug/netstandard2.0/Reactions.dll
  Rules -> /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Rules/bin/Debug/netstandard2.0/Rules.dll
  Reporting -> /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Reporting/bin/Debug/netstandard2.0/Reporting.dll
  Core -> /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Core/bin/Debug/netcoreapp2.2/Core.dll
  Plugin configurations will be stored in '/tmp/tmptuDiCe.tmp'
  Performing Dolittle post-build steps
    Performing for: /home/joel/Dolittle/ProsjektLiv/Source/Pricing/Core/bin/Debug/netcoreapp2.2/Core.dll
    Will output to: /tmp/tmp_ter4tyeq.dll
    Using plugins from: 
      /home/joel/.nuget/packages/dolittle.sdk.build/3.1.6/build/../tasks/netstandard2.0/publish/Dolittle.SDK.Build.dll
  Initializing from file '$/tmp/tmptuDiCe.tmp'
  Perform build tasks
    Generating topology, artifacts and proxies (Task: 'Dolittle.Build.BuildTask, Dolittle.SDK.Build, Version=3.1.6.0, Culture=neutral, PublicKeyToken=null')
  Error executing Dolittle post build tool
  Exception: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.ViewFeatures, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

  StackTrace:    at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
     at System.Reflection.RuntimeAssembly.GetExportedTypes()
     at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
     at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
     at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
     at Dolittle.Build.ArtifactsDiscoverer..ctor(IAssemblyContext assemblyContext, ArtifactTypes artifactTypes, IBuildMessages buildMessages) in /Users/einari/Projects/Dolittle/Runtime/DotNET.SDK/Source/Build/ArtifactsDiscoverer.cs:line 39
     at Dolittle.Build.BuildTask.Perform() in /Users/einari/Projects/Dolittle/Runtime/DotNET.SDK/Source/Build/BuildTask.cs:line 80
     at Dolittle.Build.BuildTaskPerformers.<Perform>b__3_0(ICanPerformBuildTask _) in /Users/einari/Projects/Dolittle/Fundamentals/DotNET.Fundamentals/Source/Build/BuildTaskPerformers.cs:line 44
     at Dolittle.Collections.CollectionsExtensions.ForEach[T](IEnumerable`1 enumerable, Action`1 action) in /Users/einari/Projects/Dolittle/Fundamentals/DotNET.Fundamentals/Source/Collections/CollectionsExtensions.cs:line 24
     at Dolittle.Build.BuildTaskPerformers.Perform() in /Users/einari/Projects/Dolittle/Fundamentals/DotNET.Fundamentals/Source/Build/BuildTaskPerformers.cs:line 47
     at Dolittle.Build.CLI.Program.Main(String[] args) in /Users/einari/Projects/Dolittle/Fundamentals/DotNET.Fundamentals/Source/Build.CLI/Program.cs:line 49
/home/joel/.nuget/packages/dolittle.build.msbuild/3.2.0/build/Dolittle.Build.MSBuild.targets(33,9): error MSB3073: The command "dotnet "/home/joel/.nuget/packages/dolittle.build.msbuild/3.2.0/build/../tools/netcoreapp2.1/publish/Dolittle.Build.CLI.dll" "/home/joel/Dolittle/ProsjektLiv/Source/Pricing/Core/bin/Debug/netcoreapp2.2/Core.dll" "/home/joel/.nuget/packages/dolittle.sdk.build/3.1.6/build/../tasks/netstandard2.0/publish/Dolittle.SDK.Build.dll" "/tmp/tmptuDiCe.tmp" "/tmp/tmp_ter4tyeq.dll"" exited with code 1. [/home/joel/Dolittle/ProsjektLiv/Source/Pricing/Core/Core.csproj]

Build FAILED.

/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.targets(153,5): warning NETSDK1071: A PackageReference to 'Microsoft.AspNetCore.All' specified a Version of `2.2.0`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs [/home/joel/Dolittle/ProsjektLiv/Source/Pricing/Core/Core.csproj]
/home/joel/.nuget/packages/dolittle.build.msbuild/3.2.0/build/Dolittle.Build.MSBuild.targets(33,9): error MSB3073: The command "dotnet "/home/joel/.nuget/packages/dolittle.build.msbuild/3.2.0/build/../tools/netcoreapp2.1/publish/Dolittle.Build.CLI.dll" "/home/joel/Dolittle/ProsjektLiv/Source/Pricing/Core/bin/Debug/netcoreapp2.2/Core.dll" "/home/joel/.nuget/packages/dolittle.sdk.build/3.1.6/build/../tasks/netstandard2.0/publish/Dolittle.SDK.Build.dll" "/tmp/tmptuDiCe.tmp" "/tmp/tmp_ter4tyeq.dll"" exited with code 1. [/home/joel/Dolittle/ProsjektLiv/Source/Pricing/Core/Core.csproj]
    1 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.28

┆Issue is synchronized with this Asana task

joelhoisko commented 4 years ago

Copying my /usr/share/dotnet/ folder over to /usr/local/share/dotnet/ seems to have fixed it, as only the latter is specified in files like PackageRuntimeShareAssemblyResolver.cs, NuGetFallbackFolderAssemblyResolver and PackageRuntimeStoreAssemblyResolver

pavsaund commented 4 years ago

For reference: @jakhog pointed out that using a symlink would be a better workaround:

ln -s /usr/share/dotnet /usr/local/share/dotnet

This can also be used in you Dockerfile:

RUN ln -s /usr/share/dotnet /usr/local/share/dotnet