gpt4 book ai didi

ubuntu - Ubuntu 服务器中的 DocumentFormat.OpenXml

转载 作者:太空宇宙 更新时间:2023-11-03 16:44:08 25 4
gpt4 key购买 nike

我有一个使用 Open XML SDK 的基本 C# 应用程序。我想让它在我的 Nginx & Ubuntu & DigitalOcean 服务器上运行。

该应用程序在 Windows 和我的单声道 Mac 中编译并运行良好。然后,我在 Ubuntu 服务器上安装了 mono,并将 .exe 文件 scp 到服务器,然后运行 ​​mono ConsoleApplication2.exe,它返回了以下错误:

Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
File name: 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at ConsoleApplication2.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
File name: 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at ConsoleApplication2.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

我找到了 this link ,看来问题出在 DocumentFormat.OpenXml 的版本上。但是我怎样才能在 Ubuntu 服务器上安装正确的版本呢?

有人能帮忙吗?

更新 1: 然后,我尝试安装 Open XML SDK 2.6.1,但是有 no makefile 。否则,对于 Open XML SDK 2.5,我不知道在哪里可以找到发行版。

更新 2: 我应该尝试 build.open-xml-sdk.sh... 我尝试在服务器中运行它,但它给出了 an error 。有谁知道这里出了什么问题?

更新 3: 我卸载了单声道,然后按照 this link :

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mono-complete

mono 重新安装成功。然后我再次尝试 build.open-xml-sdk.sh,但它返回了 the same error

更新 4: 根据 ZagNut 的评论,我尝试将 DLL 添加到 GAC。我注意到两件事:

1) 我下载了源代码并生成了 DocumentFormat.OpenXml.dllSystem.IO.Packaging.dll,它们使我的程序在 Visual Studio 中编译良好。但是,当我尝试通过 gacutil 将它们添加到 GAC 时,它告诉我它们需要一个strong name

2) 然后我尝试按照 this page 向它们添加 strong name ,我意识到新的 2 个 dll 无法再在 Visual Studio 中正常工作:

enter image description here

最佳答案

只需将您需要的二进制文件与您的应用程序可执行文件放在一起。

对于二进制文件,您可以自己构建它: https://github.com/OfficeDev/Open-XML-SDK

或从下面下载并使用 Universal Extractor 提取二进制文件或安装它并找到它们。

2.0:https://www.microsoft.com/en-us/download/details.aspx?id=5124

2.5:https://www.microsoft.com/en-us/download/details.aspx?id=30425

关于ubuntu - Ubuntu 服务器中的 DocumentFormat.OpenXml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39443161/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com