Giter VIP home page Giter VIP logo

Comments (19)

Woland2k avatar Woland2k commented on July 1, 2024

After a bit of digging, it looks like it has to do with .netcore2 docker image and LibSassHost targeting dotnetcore1. Image simply doesn't have older framework libraries. That said, do you have plans on migrating to dotnetcore2 anytime soon?

from libsasshost.

Taritsyn avatar Taritsyn commented on July 1, 2024

Hello, Alexander!

I am running on .net core 2.0, can this be an issue?

.NET Core 2.0 is backward compatible with .NET Core 1.0.

from libsasshost.

Woland2k avatar Woland2k commented on July 1, 2024

There is somewhat similar issue described here: aspnet/aspnet-docker#261.

from libsasshost.

Taritsyn avatar Taritsyn commented on July 1, 2024

That said, do you have plans on migrating to dotnetcore2 anytime soon?

In the next 4-5 days I will try to release a new version.

from libsasshost.

Woland2k avatar Woland2k commented on July 1, 2024

Went through couple more troubleshooting scenarios:

  1. It does work on OSX on the developer machine (not new docker instance).
  2. Does work on Docker for Windows with Linuze Containers when application is published using self-contained deployment and specifying specific "debian-x64" as a runtime ID. Here is a command
    dotnet publish -r "debian-x64"

So it looks that some DLLs are missing in pure netcore2.0 docker debian image which are included when self-contained publishing is used.

from libsasshost.

Taritsyn avatar Taritsyn commented on July 1, 2024

You have the following code in *.csproj file?

<PropertyGroup>
	<RuntimeIdentifiers>…;debian-x64</RuntimeIdentifiers>
</PropertyGroup>

from libsasshost.

Woland2k avatar Woland2k commented on July 1, 2024

@Taritsyn no, we don't have that. I'd like this project to be as generic as possible, so it can be deployed in any docker container (windows or linux). Specifying RuntimeIdentifiers is typically only for self-contained publishing which in turn increases the size of the whole docker image (same as specifying -r "debian-x64" during publish, it is an ok workaround for now and I'm glad it is working).

You can see the source code here: https://github.com/VirtoCommerce/vc-storefront-core/blob/dev/VirtoCommerce.Storefront/VirtoCommerce.Storefront.csproj

from libsasshost.

Taritsyn avatar Taritsyn commented on July 1, 2024

Hello, Alexander!

In version 1.1.0 added support of .NET Standard 2.0. In addition, LibSassHost.Native.debian-x64 package has been replaced by the LibSassHost.Native.linux-x64 package.

But it seems to me, that these changes will not help to solve your problem. You still need to add to *.csproj file the following code:

<PropertyGroup>
	<RuntimeIdentifiers>…;linux-x64</RuntimeIdentifiers>
</PropertyGroup>

from libsasshost.

Woland2k avatar Woland2k commented on July 1, 2024

Awesome, I'll check it now!

from libsasshost.

Woland2k avatar Woland2k commented on July 1, 2024

It works perfectly now! No need for RuntimeIdentifiers or self-contained deployments. Thanks for the quick release.

from libsasshost.

Woland2k avatar Woland2k commented on July 1, 2024

Actually now I'm getting same error in windows container (it is windowsnano) and I have VC 2015 redist installed, any suggestions?:

Compiler error: System.TypeInitializationException: The type initializer for 'LibSassHost.SassCompiler' threw an exception. ---> LibSassHost.SassCompilerLoadException: During loading of Sass-compiler error has occurred.

Most likely it happened, because failed to load the native implementation of the LibSass library. Therefore, you need to choose and install the most appropriate NuGet package(s) for your platform. The following packages are available:

* LibSassHost.Native.win-x86
* LibSassHost.Native.win-x64
* LibSassHost.Native.debian-x64
* LibSassHost.Native.osx-x64 ---> System.DllNotFoundException: Unable to load DLL 'libsass': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at LibSassHost.Internal.Native.Sass_Api.libsass_version()
   at LibSassHost.Internal.SassCompilerProxy.GetVersion()
   at LibSassHost.SassCompiler..cctor()
   --- End of inner exception stack trace ---
   at LibSassHost.SassCompiler..cctor()
   --- End of inner exception stack trace ---
   at LibSassHost.SassCompiler.Compile(String content, CompilationOptions options)

from libsasshost.

Taritsyn avatar Taritsyn commented on July 1, 2024

Hello, Alexander!

It is possible, that the Visual C++ Redistributable for Visual Studio 2015 is not installed on the server.

from libsasshost.

Woland2k avatar Woland2k commented on July 1, 2024

Yeah, I think there is something wrong with installing VC redist on Windows Nano server, as the code below doesn't seem to be installing VC correctly. Is the DLL not included with a win nuget because of licensing restrictions?

Btw, below is my dockerfile i use to generate the package for windows.

# escape=`
# Build runtime image
FROM microsoft/aspnetcore:2.0

RUN Invoke-WebRequest "https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe" -OutFile "c:\vc_redist.x64.exe"
RUN powershell start-process C:\vc_redist.x64.exe -ArgumentList '/quiet' -Wait
ARG SOURCE=VirtoCommerce.Storefront\bin\Debug\netcoreapp2.0\publish
WORKDIR /app
COPY $SOURCE .
ENTRYPOINT ["dotnet", "VirtoCommerce.Storefront.dll"]

from libsasshost.

Taritsyn avatar Taritsyn commented on July 1, 2024

Yeah, I think there is something wrong with installing VC redist on Windows Nano server, as the code below doesn't seem to be installing VC correctly.

Try to install through the Chocolatey or deploy the msvcp140.dll assembly manually.

from libsasshost.

Woland2k avatar Woland2k commented on July 1, 2024

I copied msvcp140.dll manually to c:\windows\system32 folder and now getting the following error:

Compiler error: System.TypeInitializationException: The type initializer for 'LibSassHost.SassCompiler' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
   at LibSassHost.Internal.Native.Sass_Api.libsass_version()
   at LibSassHost.Internal.SassCompilerProxy.GetVersion()
   at LibSassHost.SassCompiler..cctor()
   --- End of inner exception stack trace ---
   at LibSassHost.SassCompiler.Compile(String content, CompilationOptions options)

from libsasshost.

Woland2k avatar Woland2k commented on July 1, 2024

Ok, I think I resolved it by copying 2 64 bit libraries to windows\system32 folder just like this:

COPY libs\x64\msvcp140.dll c:\windows\system32
COPY libs\x64\vcruntime140.dll c:\windows\system32

from libsasshost.

Taritsyn avatar Taritsyn commented on July 1, 2024

In principle, these assemblies could be deployed locally (in the bin directory of web application).

from libsasshost.

Woland2k avatar Woland2k commented on July 1, 2024

No bin folder in published version of .netcore2 and since it is docker image, it is fine to have it in that folder. Kinda odd though that system32 needs 64bit version of the dll.

from libsasshost.

Taritsyn avatar Taritsyn commented on July 1, 2024

Hello, Alexander!

Since version 1.2.6 the MSVC runtime was embedded into the native assemblies for Windows. Now you do not need to install the Microsoft Visual C++ Redistributable.

from libsasshost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.