Skip to content

Instantly share code, notes, and snippets.

@diyan
Last active September 30, 2019 13:24
Show Gist options
  • Save diyan/b66a39f187953dcd786caee1732693cd to your computer and use it in GitHub Desktop.
Save diyan/b66a39f187953dcd786caee1732693cd to your computer and use it in GitHub Desktop.
FAILED experiment. Setup Wine, winetricks, dotnet461, NuGet. Compile ASP.NET Web Forms Web Site using Wine/MSBuild
FROM debian:9.11
# Wine on Debian 9, see https://wiki.winehq.org/Debian
# Winetricks, see https://wiki.winehq.org/Winetricks#Installing_winetricks
RUN set -x \
    && tempDeps='software-properties-common apt-transport-https gnupg wget curl cabextract' \
    && apt-get update \
    && apt-get install -y --no-install-recommends $tempDeps \
    && dpkg --add-architecture i386 \
    && wget -qO - https://dl.winehq.org/wine-builds/winehq.key | apt-key add - \
    && apt-add-repository https://dl.winehq.org/wine-builds/debian/ \
    && apt-get update \
    && apt-get install -y --no-install-recommends winehq-stable \
    && curl -s https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks > /usr/local/bin/winetricks \
    && chmod +x /usr/local/bin/winetricks \
    && winetricks -q dotnet461 \
    && winetricks -q nuget

# Install deps before copying code, use docker cache for external packages
COPY ["Example.sln", "website.publishproj", "packages.config", "/app/"]
RUN set -x \
    && apt-get update \
    && apt-get -y install vim mc tree less locate procps net-tools
# Suppress Wine debug output with WINEDEBUG=-all
# NuGet v2.8.6 shipped in winetricks
# NuGet v2.12+ is required for System.Buffers, System.Memory, Newtonsoft.Json, etc
# NuGet <= v4.5.3 works under Wine v4.0.2 but NuGet v4.6.4+ crashes with Win32Exception
RUN set -x \
    && cd /app \
    && export WINEDEBUG=-all \
    && curl -o /root/.wine/drive_c/windows/syswow64/nuget.exe https://dist.nuget.org/win-x86-commandline/v4.5.3/nuget.exe \
    && wine nuget install MSBuild.Microsoft.VisualStudio.Web.targets -Version 14.0.0.3 -OutputDirectory packages \
    && wine nuget restore packages.config -SolutionDirectory .
# Copy source tree and build everything
COPY . /app/
CMD bash

FAIL Output. Process crash in a Bash shell:

$ cd ~/.wine/drive_c/windows/Microsoft.NET/Framework64/v4.0.30319
$ WINEDEBUG=+err wine msbuild
...
0035:err:eventlog:ReportEventW L"Application: msbuild.exe\nFramework Version: v4.0.30319\nDescription: The process was terminated due to an internal error in the .NET Runtime at IP 0000000000764481 (0000000000750000) with exit code 80131506.\n"

FAIL Output. MSBuild crash in a Wine/CMD shell:

$ export WINEDEBUG=-all
$ wine cmd
CMD> SET PATH=%PATH%;C:\windows\Microsoft.NET\Framework64\v4.0.30319
CMD> SET WINEDEBUG=+err
CMD> msbuild
...
0035:err:eventlog:ReportEventW L"Application: MSBuild.exe\nFramework Version: v4.0.30319\nDescription: The process was terminated due to an internal error in the .NET Runtime at IP 0000000000774481 (0000000000760000) with exit code 80131506.\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment