.net - 如何在 Wine 64 位前缀中安装 .NET 4?
问题描述
我正在尝试让 .NET 应用程序在 Docker 容器中的 Windows 上运行,它需要 .NET 4。我已经让它在 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 构建日志
3.13的结果非常相似。它以同样的方式结束。我做了很多搜索,几乎所有内容都是关于如何让它适用于 32 位的东西。我见过的少数 64 位线程没有提供有关如何手动安装 .NET 4 的足够详细信息。
解决方案
我发现问题在于我使用的是 winehq-staging 而不是 winehq-devel。在 winehq-devel=3.12.0~xenial 的情况下,winetricks 中的 dotnet40 动词有效。实际上,即使是 dotnet472 动词现在也可以使用最新版本。
推荐阅读
- python - 如何最好地实现链接变量?
- python - 如何过滤 sys.stdout?
- php - Array Combination need as like below
- xamarin - xamarin 复数 电磁学
- node.js - 为什么在 expressjs 中的 POST 请求上清空 req.body?
- bash - 脚本在本地运行但在 Jenkins 上失败(得到 SIGTERM,退出)
- node.js - 如何在同一网络中的spring boot和nodejs应用程序之间进行通信而无需登录特定端点
- apache-spark - 独立集群中的 Spark Streaming 多次接收相同的 Kafka 消息
- jquery - 在 Excel 工作表中导出动态 Jquery 变量数据
- java - 无向图 Java