如何在Wine 64位前缀中安装.NET 4?

时间:2018-08-14 21:59:40

标签: .net docker 64-bit wine

我正在尝试在Docker容器中的Windows上运行.NET应用程序,并且它需要.NET4。我已使其在32位上运行,但我需要64位才能获得额外的内存空间。这是一个专门的科学应用。

这是Dockerfile:

FROM ubuntu:16.04

# we need wget, bzip2, wine from winehq, 
# xvfb to fake X11 for winetricks during installation,
# and winbind because wine complains about missing 
# Prevents annoying debconf errors during builds
ARG DEBIAN_FRONTEND="noninteractive"
RUN dpkg --add-architecture i386 \
    && apt-get update \
    && apt-get install -y \
        software-properties-common \
        winbind \
        cabextract \
        p7zip \
        unzip \
        wget \
        zenity \
        xvfb && \
    apt-get -y clean && \
    rm -rf \
      /var/lib/apt/lists/* \
      /usr/share/doc \
      /usr/share/doc-base \
      /usr/share/man \
      /usr/share/locale \
      /usr/share/zoneinfo

ENV WINEDISTRO=staging
ENV WINEVERSION=3.12.0~xenial

# Install wine
RUN wget -nc https://dl.winehq.org/wine-builds/Release.key \
    && apt-key add Release.key \
    && apt-get update \
    && apt-get install -y apt-transport-https \
    && add-apt-repository https://dl.winehq.org/wine-builds/ubuntu/ \
    && apt-get update \
    && apt-get install -y --install-recommends winehq-$WINEDISTRO=$WINEVERSION wine-$WINEDISTRO=$WINEVERSION wine-$WINEDISTRO-i386=$WINEVERSION wine-$WINEDISTRO-amd64=$WINEVERSION && \
    apt-get -y clean && \
    rm -rf \
      /var/lib/apt/lists/* \
      /usr/share/doc \
      /usr/share/doc-base \
      /usr/share/man \
      /usr/share/locale \
      /usr/share/zoneinfo \
      && \
    wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks \
      -O /usr/local/bin/winetricks && chmod +x /usr/local/bin/winetricks

# put C:\pwiz on the Windows search path
ENV WINEARCH win64
ENV WINEDEBUG -all,err+all

# To be singularity friendly, avoid installing anything to /root
RUN mkdir -p /wineprefix64/
ENV WINEPREFIX /wineprefix64
WORKDIR /wineprefix64

# wineserver needs to shut down properly!!! 
ADD waitonprocess.sh /wineprefix64/waitonprocess.sh
RUN chmod +x waitonprocess.sh

# Install dependencies
RUN winetricks -q win7 && xvfb-run winetricks -q dotnet45 && ./waitonprocess.sh wineserver

我尝试了WINE和3.13、3.12、3.11、3.10、3.9,结果几乎相同。如果我安装了一个干净的前缀,我实际上会很快得到一个错误:

Step 4/47 : FROM ubuntu:16.04
Step 19/47 : ARG DEBIAN_FRONTEND="noninteractive"
Step 20/47 : RUN dpkg --add-architecture i386     && apt-get update     && apt-get install -y         software-properties-common         winbind         cabextract         p7zip         unzip         wget         zenity         xvfb &&     apt-get -y clean &&     rm -rf       /var/lib/apt/lists/*       /usr/share/doc       /usr/share/doc-base       /usr/share/man       /usr/share/locale       /usr/share/zoneinfo
Step 21/47 : ENV WINEDISTRO=staging
Step 22/47 : ENV WINEVERSION=3.13.0~xenial
Step 23/47 : RUN wget -nc https://dl.winehq.org/wine-builds/Release.key     && apt-key add Release.key     && apt-get update     && apt-get install -y apt-transport-https     && add-apt-repository https://dl.winehq.org/wine-builds/ubuntu/     && apt-get update     && apt-get install -y --install-recommends winehq-$WINEDISTRO=$WINEVERSION wine-$WINEDISTRO=$WINEVERSION wine-$WINEDISTRO-i386=$WINEVERSION wine-$WINEDISTRO-amd64=$WINEVERSION &&     apt-get -y clean &&     rm -rf       /var/lib/apt/lists/*       /usr/share/doc       /usr/share/doc-base       /usr/share/man       /usr/share/locale       /usr/share/zoneinfo       &&     wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks       -O /usr/local/bin/winetricks && chmod +x /usr/local/bin/winetricks
Step 24/47 : ENV WINEARCH win64
Step 25/47 : ENV WINEDEBUG -all,err+all
Step 28/47 : RUN mkdir -p /wineprefix64/
Step 29/47 : ENV WINEPREFIX /wineprefix64
Step 30/47 : WORKDIR /wineprefix64
Step 31/47 : ADD waitonprocess.sh /wineprefix64/waitonprocess.sh
Step 32/47 : RUN chmod +x waitonprocess.sh
Step 34/47 : RUN xvfb-run winetricks -q dotnet45 && ./waitonprocess.sh wineserver
 ---> Running in c0f8d76792c5
------------------------------------------------------
Running Wine/winetricks as root is highly discouraged. See https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F
------------------------------------------------------
------------------------------------------------------
wine cmd.exe /c echo '%ProgramFiles%' returned unexpanded string '%ProgramFiles%' ... this can be caused by a corrupt wineprefix, by an old wine, or by not owning /wineprefix64
------------------------------------------------------
The command '/bin/sh -c xvfb-run winetricks -q dotnet45 && ./waitonprocess.sh wineserver' returned a non-zero code: 1

如果我先安装操作系统版本,则它会更进一步,并在最后挂起。 wine-staging-3.12-amd64-win7-dotnet45 build log

3.13的结果非常相似。它以相同的方式结束。我已经做了很多搜索,几乎所有内容都是关于如何使其适用于32位内容的。我见过的一些64位线程没有提供有关如何手动安装.NET 4的足够详细信息。

1 个答案:

答案 0 :(得分:1)

我发现问题是我正在使用winehq-stage而不是winehq-devel。在winehq-devel = 3.12.0〜xenial下,winetricks中的dotnet40动词有效。实际上,即使dotnet472动词现在也可以在最新版本中使用。