我需要使用运行在F#框架上的.NET 4.5 (而不是.NET核心)。我希望这个环境运行在一个码头容器中,因为它将在我们的Jenkins构建服务器上定期运行。我认为我可以使用现有的.NET框架SDK映像,但它只有F# for .NET Core/.NET 5。
因此,我试图将F#安装到正在运行的容器中(如果可以的话,我会将它添加到映像本身中),但我没有任何运气。这是我的尝试..。
project文件夹project1. Install ManagedDesktopBuildTools with optional componentsstart /w vs_BuildTools --添加/w vs_BuildTools--安静--不重新启动--不缓存--等等--包括
启动/w vs_BuildTools修改--添加/w--安静--不重新启动--不缓存--等等--包括
2. Install F# Component Explicitlystart /w vs_BuildTools --添加/w vs_BuildTools--安静--不重新启动--nocache --等等
启动/w vs_BuildTools修改--添加/w--安静--不重新启动--不缓存--等等
在任何情况下我都能得到各种各样的.
[08f8:0001][2021-05-10T20:49:21] Visual Studio Installer Version: 2.9.3365
[08f8:0001][2021-05-10T20:49:21] Raw Command line: "C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe" modify --add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools --quiet --norestart --nocache --includeOptional --locale en-US --activityId "d43641b0-241b-48be-b6ff-6625487b134e"
[08f8:0001][2021-05-10T20:49:21] Warning: Closing the installer with exit code 87
... more logs ...
[08f8:0001][2021-05-10T20:49:22] Warning: Failed to parse the command line arguments: The current operation needs either --channelId and
--productId or --installPath Usage: setup.exe modify [options]
... more logs ...
[08f8:0001][2021-05-10T20:49:22] Warning: Shutting down the application with exit code 87
[08f8:0001][2021-05-10T20:49:22] Closing the installer with exit code 87
[08f8:0001][2021-05-10T20:49:22] Exit Code: 87或
[07b8:0012][2021-05-10T22:33:50] Warning: Shutting down the application with exit code 1
[07b8:0012][2021-05-10T22:33:50] Warning: Visual Studio Build Tools 2019 (2) is already installed.
[07b8:0001][2021-05-10T22:33:50] Releasing singleton lock.
[07b8:0001][2021-05-10T22:33:50] Releasing singleton lock succeed.
[07b8:0001][2021-05-10T22:33:50] Releasing singleton lock.
[07b8:0001][2021-05-10T22:33:50] Singleton lock does not exist. Releasing singleton lock skipped.
[07b8:0001][2021-05-10T22:33:50] Closing the installer with exit code 1甚至
[044c:0001][2021-05-10T22:55:26] Exception occured while trying to write telemetry session to the network. One or more errors occurred.
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Setup.Services.Telemetry.FlushTelemetrySession(Boolean shouldRecreate)我做错了什么?
发布于 2021-05-21 17:29:54
TLDR
我能够通过使用F#编译器工具安装帕克特来解决这个问题。用于F# 4.5的F#编译器工具运行在.NET框架(或mono)上,而F# 5则运行在.NET Core (或.NET 5)上。
详细信息
创建Dockerfile
我的Dockerfile看起来和以前没什么不同。我仍然把它建立在MicrosoftFrameworkSDK4.8映像的基础上,因为我希望访问.NET .NET。
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 as build
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
#
# INSTALL SAP CRYSTAL REPORTS DEVELOPER VERSION FOR MICROSOFT VISUAL STUDIO STUDIO 32 BIT & 64 BIT
# Downloads for CR can be found at https://origin.softwaredownloads.sap.com/public/site/index.html
#
WORKDIR /installers
# Add oledlg dlls so that the Crystal Reports runtime will install. For more infomation see:
# https://stackoverflow.com/a/56072716/19977
COPY Resources/Files/64/oledlg.dll /windows/syswow64/oledlg.dll
COPY Resources/Files/32/oledlg.dll /windows/system32/oledlg.dll
ARG CR_DOWNLOAD_URL_32=https://origin.softwaredownloads.sap.com/public/file/0020000000195592021
ARG CR_32_HASH=425D88E82832784A9E53897C43F54A6E0423FFCBFA536C12253378E5C4646CD7
ARG CR_DOWNLOAD_URL_64=https://origin.softwaredownloads.sap.com/public/file/0020000000195602021
ARG CR_64_HASH=2BAB57DC3E8C69A2DB3835FEFF11E52B5D9C19020DC9A08302A97618F8304C1B
RUN Invoke-WebRequest "$env:CR_DOWNLOAD_URL_32" -OutFile 'cr32.msi'; \
Invoke-WebRequest "$env:CR_DOWNLOAD_URL_64" -OutFile 'cr64.msi'; \
if ((Get-FileHash 'cr32.msi').Hash -ne "$env:CR_32_HASH") { \
Write-Error 'Crystal Reports 32 bit hashes do not match. Stopping build.' \
} \
if ((Get-FileHash 'cr64.msi').Hash -ne "$env:CR_64_HASH") { \
Write-Error 'Crystal Reports 64 bit hashes do not match. Stopping build.' \
} \
Start-Process 'msiexec.exe' -Wait -ArgumentList '/i "C:\installers\cr32.msi" /quiet /qn /norestart /L*V "C:\Windows\Temp\cr32_install.log"'; \
Start-Process 'msiexec.exe' -Wait -ArgumentList '/i "C:\installers\cr64.msi" /quiet /qn /norestart /L*V "C:\Windows\Temp\cr64_install.log"'; \
Remove-Item 'cr32.msi'; \
Remove-Item 'cr64.msi';
FROM build as dev
WORKDIR /dev塑造形象
当Dockerfile解决时,我们构建映像。
docker build -t fsharp-image . --target dev运行容器
docker run -it --rm -v "$(pwd):C:\dev" --name fsharp-image fsharp-image安装Paket
我使用首选( 开始核心)选项遵循了.NET Paket指令。这些命令在正在运行的容器中执行。
安装F#编译器工具
现在安装了Paket,我们就可以安装F#编译器工具了。
paket add FSharp.Compiler.Tools --version 10.2.3确认F# 4.5安装
为了确认F# 4.5的安装,我们运行以下命令。
packages\FSharp.Compiler.Tools\tools\fsi.exe这应该是输出
Microsoft (R) F# Interactive version 10.2.3 for F# 4.5
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;运行TestOpenCrystalReportsDocument.fsx
然后我创建了一个小脚本来测试完整的安装。
// TestOpenCrystalReportsDocument.fsx
#r "CrystalDecisions.CrystalReports.Engine"
#r "CrystalDecisions.Shared"
open CrystalDecisions.CrystalReports.Engine
open CrystalDecisions.Shared
let openDoc path =
let doc = new ReportDocument()
doc.Load path
doc
printfn "OPEN DOC"
let doc = openDoc "C:\\dev\\test.rpt"
printfn "SUCCESS"最后,我们运行脚本
packages\FSharp.Compiler.Tools\tools\fsi.exe TestOpenCrystalReportsDocument.fsx输出显示我们没有错误!
OPEN DOC
SUCCESS包起来
为了结束,我提交了以下文件。
每当我重新运行容器时,我只需要执行dotnet tool restore和dotnet paket restore来重新安装paket和F# 4.5编译器工具。
https://stackoverflow.com/questions/67479997
复制相似问题