使用 mkbundle 构建的 C# 应用程序不起作用
C# application built with mkbundle doesn't work
我正在尝试使用 MkBundle 构建 this C# program 以便用户可以 运行 在 Linux 上使用它而无需安装 Mono。
但是我在尝试使用构建的程序时总是遇到错误。
重现步骤:
- Git 克隆这个项目:
https://github.com/nddipiazza/Sharepoint-Exporter
- 从中提取 DLL:
https://www.microsoft.com/en-us/download/confirmation.aspx?id=35585 -
在解决方案资源管理器中,右键单击引用 -> 添加引用 -> 浏览 .NET 程序集 -> 添加 Microsoft 共享点 DLL
- Microsoft.SharePoint.Client.dll
- Microsoft.SharePoint.Client.Runtime.dll
构建应用程序。
(或者只是从这里 https://drive.google.com/a/lucidworks.com/file/d/1GPgkmike9KYTDBGLuNj0R_0Q_FDQdhKr/view?usp=sharing 获取构建的应用程序)
- 运行:
mkbundle --simple --static --deps -o ./SpFetcher bin/Release/SpPrefetchIndexBuilder.exe
请注意,包似乎构建成功:
ndipiazza@mate:~/lucidworks/Sharepoint-Exporter/SpCrawler (master)*$ mkbundle --simple --static --deps -o ./SpFetcher bin/Release/SpPrefetchIndexBuilder.exe
Using runtime: /usr/bin/mono
Assembly: /home/ndipiazza/lucidworks/Sharepoint-Exporter/SpCrawler/bin/Release/SpPrefetchIndexBuilder.exe
Config: /usr/bin/mono
Assembly: /usr/lib/mono/4.5/mscorlib.dll
Assembly: /usr/lib/mono/4.5/System.Net.Http.dll
Assembly: /usr/lib/mono/4.5/System.dll
Assembly: /usr/lib/mono/4.5/Mono.Security.dll
Assembly: /usr/lib/mono/4.5/System.Configuration.dll
Assembly: /usr/lib/mono/4.5/System.Xml.dll
Assembly: /usr/lib/mono/4.5/System.Security.dll
Assembly: /usr/lib/mono/4.5/System.Core.dll
Assembly: /usr/lib/mono/4.5/Mono.Posix.dll
Assembly: /usr/lib/mono/4.5/System.Web.Extensions.dll
Assembly: /usr/lib/mono/4.5/System.Web.dll
Assembly: /usr/lib/mono/4.5/System.Drawing.dll
Assembly: /usr/lib/mono/4.5/System.Runtime.Serialization.Formatters.Soap.dll
Assembly: /usr/lib/mono/4.5/System.Data.dll
Assembly: /usr/lib/mono/4.5/System.Numerics.dll
Assembly: /usr/lib/mono/4.5/System.Transactions.dll
Assembly: /usr/lib/mono/4.5/Mono.Data.Tds.dll
Assembly: /usr/lib/mono/4.5/System.EnterpriseServices.dll
Assembly: /usr/lib/mono/4.5/System.Web.ApplicationServices.dll
Assembly: /usr/lib/mono/4.5/System.ComponentModel.DataAnnotations.dll
Assembly: /usr/lib/mono/4.5/Mono.Data.Sqlite.dll
Assembly: /usr/lib/mono/4.5/System.Web.Services.dll
Assembly: /usr/lib/mono/4.5/System.DirectoryServices.dll
Assembly: /usr/lib/mono/4.5/Novell.Directory.Ldap.dll
Assembly: /usr/lib/mono/4.5/System.Design.dll
Assembly: /usr/lib/mono/4.5/System.Windows.Forms.dll
Assembly: /usr/lib/mono/4.5/Accessibility.dll
Assembly: /usr/lib/mono/4.5/Mono.WebBrowser.dll
Assembly: /usr/lib/mono/4.5/System.Data.Linq.dll
Assembly: /usr/lib/mono/4.5/System.Runtime.Serialization.dll
Assembly: /usr/lib/mono/4.5/System.ServiceModel.Internals.dll
Assembly: /usr/lib/mono/4.5/System.ServiceModel.dll
Assembly: /usr/lib/mono/4.5/System.IdentityModel.dll
Assembly: /usr/lib/mono/4.5/System.Messaging.dll
Assembly: /usr/lib/mono/4.5/Mono.Messaging.dll
Assembly: /usr/lib/mono/4.5/System.Configuration.Install.dll
Assembly: /usr/lib/mono/4.5/System.IdentityModel.Selectors.dll
Assembly: /usr/lib/mono/4.5/System.ServiceModel.Activation.dll
Assembly: /home/ndipiazza/lucidworks/Sharepoint-Exporter/SpCrawler/Microsoft.SharePoint.Client.dll
Assembly: /home/ndipiazza/lucidworks/Sharepoint-Exporter/SpCrawler/Microsoft.SharePoint.Client.Runtime.dll
Assembly: /usr/lib/mono/4.5/System.Xml.Linq.dll
Assembly: /usr/lib/mono/4.5/I18N.West.dll
Assembly: /usr/lib/mono/4.5/I18N.dll
Generated ./SpFetcher
现在 运行 ./SpFetcher
程序
在Mono的机器上运行正常
在没有单声道的机器上,你会得到这个错误:
无法识别 URI 前缀。
在 System.Net.WebRequest.Create (System.Uri requestUri, System.Boolean useUriBase) [0x000ae] 在 <50d80b08c1a5449282b22aedf03ce925>:0
在 System.Net.WebRequest.Create (System.String requestUriString) [0x00014] 在 <50d80b08c1a5449282b22aedf03ce925>:0
在 Microsoft.SharePoint.Client.SPWebRequestExecutor..ctor (Microsoft.SharePoint.Client.ClientRuntimeContext context, System.String requestUrl) [0x0002e] in :0
在 Microsoft.SharePoint.Client.DefaultWebRequestExecutorFactory.CreateWebRequestExecutor(Microsoft.SharePoint.Client.ClientRuntimeContext 上下文,System.String requestUrl)[0x00021] in :0
在 Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate () [0x0000d] 在 :0
在 Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest () [0x0001f] 在 :0
在 Microsoft.SharePoint.Client.ClientContext.ExecuteQuery () [0x00008] 在 :0
在 SpPrefetchIndexBuilder.SpPrefetchIndexBuilder.getSubWebs (System.String url, System.Collections.Generic.Dictionary`2[TKey,TValue] parentWebDict) [0x00266] in <8afd075a89d9457b827aef736e8e1c09>:0
在 SpPrefetchIndexBuilder.SpPrefetchIndexBuilder.Main (System.String[] args) [0x00018] 在 <8afd075a89d9457b827aef736e8e1c09>:0
该错误不是预期的。
mkbundle
程序是否运行不正常?
我正在尝试 mkbundle 的 c# 程序:https://drive.google.com/a/lucidworks.com/file/d/1GPgkmike9KYTDBGLuNj0R_0Q_FDQdhKr/view?usp=sharing
mkbundled 结果:https://drive.google.com/file/d/13kHG-RxSqfMFlE53wCSe9iqfwOzheKUm/view?usp=sharing
更新:我已经在 mkbundle 问题跟踪器上创建了一张票。 https://bugzilla.xamarin.com/show_bug.cgi?id=60753#bug_status_bottom
得到一位项目所有者的回复migueldeicaza on the github ticket I created:
This is caused by a missing machine.config file in the bundled
executable.
Probably we should make it so that mkbundle ships the machine.config
as well, in the meantime use:
mkbundle --simple --deps -o foo a.exe --machine-config
/etc/mono/4.5/machine.config And the problem is that without automatic
shipping of machine.config, developers will struggle with the cross
compiler to find the proper path.
先看看我创建的那张工单上的对话,然后你应该知道要更改什么。就我而言,这有效:
MONO_LOG_MASK=asm MONO_LOG_LEVEL=debug mkbundle --simple --static --deps -o ./SpFetcher --config /etc/mono/config --machine-config /etc/mono/4.5/machine.config bin/Release/SpPrefetchIndexBuilder.exe
终于成功了。我针对 ubuntumate 16 构建了它,然后将其移动到没有安装单声道的 ubuntumate 17 机器上,运行 它通过了!
我正在尝试使用 MkBundle 构建 this C# program 以便用户可以 运行 在 Linux 上使用它而无需安装 Mono。
但是我在尝试使用构建的程序时总是遇到错误。
重现步骤:
- Git 克隆这个项目:
https://github.com/nddipiazza/Sharepoint-Exporter
- 从中提取 DLL:
https://www.microsoft.com/en-us/download/confirmation.aspx?id=35585 -
在解决方案资源管理器中,右键单击引用 -> 添加引用 -> 浏览 .NET 程序集 -> 添加 Microsoft 共享点 DLL
- Microsoft.SharePoint.Client.dll
- Microsoft.SharePoint.Client.Runtime.dll
构建应用程序。
(或者只是从这里 https://drive.google.com/a/lucidworks.com/file/d/1GPgkmike9KYTDBGLuNj0R_0Q_FDQdhKr/view?usp=sharing 获取构建的应用程序)
- 运行:
mkbundle --simple --static --deps -o ./SpFetcher bin/Release/SpPrefetchIndexBuilder.exe
请注意,包似乎构建成功:
ndipiazza@mate:~/lucidworks/Sharepoint-Exporter/SpCrawler (master)*$ mkbundle --simple --static --deps -o ./SpFetcher bin/Release/SpPrefetchIndexBuilder.exe
Using runtime: /usr/bin/mono
Assembly: /home/ndipiazza/lucidworks/Sharepoint-Exporter/SpCrawler/bin/Release/SpPrefetchIndexBuilder.exe
Config: /usr/bin/mono
Assembly: /usr/lib/mono/4.5/mscorlib.dll
Assembly: /usr/lib/mono/4.5/System.Net.Http.dll
Assembly: /usr/lib/mono/4.5/System.dll
Assembly: /usr/lib/mono/4.5/Mono.Security.dll
Assembly: /usr/lib/mono/4.5/System.Configuration.dll
Assembly: /usr/lib/mono/4.5/System.Xml.dll
Assembly: /usr/lib/mono/4.5/System.Security.dll
Assembly: /usr/lib/mono/4.5/System.Core.dll
Assembly: /usr/lib/mono/4.5/Mono.Posix.dll
Assembly: /usr/lib/mono/4.5/System.Web.Extensions.dll
Assembly: /usr/lib/mono/4.5/System.Web.dll
Assembly: /usr/lib/mono/4.5/System.Drawing.dll
Assembly: /usr/lib/mono/4.5/System.Runtime.Serialization.Formatters.Soap.dll
Assembly: /usr/lib/mono/4.5/System.Data.dll
Assembly: /usr/lib/mono/4.5/System.Numerics.dll
Assembly: /usr/lib/mono/4.5/System.Transactions.dll
Assembly: /usr/lib/mono/4.5/Mono.Data.Tds.dll
Assembly: /usr/lib/mono/4.5/System.EnterpriseServices.dll
Assembly: /usr/lib/mono/4.5/System.Web.ApplicationServices.dll
Assembly: /usr/lib/mono/4.5/System.ComponentModel.DataAnnotations.dll
Assembly: /usr/lib/mono/4.5/Mono.Data.Sqlite.dll
Assembly: /usr/lib/mono/4.5/System.Web.Services.dll
Assembly: /usr/lib/mono/4.5/System.DirectoryServices.dll
Assembly: /usr/lib/mono/4.5/Novell.Directory.Ldap.dll
Assembly: /usr/lib/mono/4.5/System.Design.dll
Assembly: /usr/lib/mono/4.5/System.Windows.Forms.dll
Assembly: /usr/lib/mono/4.5/Accessibility.dll
Assembly: /usr/lib/mono/4.5/Mono.WebBrowser.dll
Assembly: /usr/lib/mono/4.5/System.Data.Linq.dll
Assembly: /usr/lib/mono/4.5/System.Runtime.Serialization.dll
Assembly: /usr/lib/mono/4.5/System.ServiceModel.Internals.dll
Assembly: /usr/lib/mono/4.5/System.ServiceModel.dll
Assembly: /usr/lib/mono/4.5/System.IdentityModel.dll
Assembly: /usr/lib/mono/4.5/System.Messaging.dll
Assembly: /usr/lib/mono/4.5/Mono.Messaging.dll
Assembly: /usr/lib/mono/4.5/System.Configuration.Install.dll
Assembly: /usr/lib/mono/4.5/System.IdentityModel.Selectors.dll
Assembly: /usr/lib/mono/4.5/System.ServiceModel.Activation.dll
Assembly: /home/ndipiazza/lucidworks/Sharepoint-Exporter/SpCrawler/Microsoft.SharePoint.Client.dll
Assembly: /home/ndipiazza/lucidworks/Sharepoint-Exporter/SpCrawler/Microsoft.SharePoint.Client.Runtime.dll
Assembly: /usr/lib/mono/4.5/System.Xml.Linq.dll
Assembly: /usr/lib/mono/4.5/I18N.West.dll
Assembly: /usr/lib/mono/4.5/I18N.dll
Generated ./SpFetcher
现在 运行
./SpFetcher
程序在Mono的机器上运行正常
在没有单声道的机器上,你会得到这个错误:
无法识别 URI 前缀。 在 System.Net.WebRequest.Create (System.Uri requestUri, System.Boolean useUriBase) [0x000ae] 在 <50d80b08c1a5449282b22aedf03ce925>:0 在 System.Net.WebRequest.Create (System.String requestUriString) [0x00014] 在 <50d80b08c1a5449282b22aedf03ce925>:0 在 Microsoft.SharePoint.Client.SPWebRequestExecutor..ctor (Microsoft.SharePoint.Client.ClientRuntimeContext context, System.String requestUrl) [0x0002e] in :0 在 Microsoft.SharePoint.Client.DefaultWebRequestExecutorFactory.CreateWebRequestExecutor(Microsoft.SharePoint.Client.ClientRuntimeContext 上下文,System.String requestUrl)[0x00021] in :0 在 Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate () [0x0000d] 在 :0 在 Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest () [0x0001f] 在 :0 在 Microsoft.SharePoint.Client.ClientContext.ExecuteQuery () [0x00008] 在 :0 在 SpPrefetchIndexBuilder.SpPrefetchIndexBuilder.getSubWebs (System.String url, System.Collections.Generic.Dictionary`2[TKey,TValue] parentWebDict) [0x00266] in <8afd075a89d9457b827aef736e8e1c09>:0 在 SpPrefetchIndexBuilder.SpPrefetchIndexBuilder.Main (System.String[] args) [0x00018] 在 <8afd075a89d9457b827aef736e8e1c09>:0
该错误不是预期的。
mkbundle
程序是否运行不正常?
我正在尝试 mkbundle 的 c# 程序:https://drive.google.com/a/lucidworks.com/file/d/1GPgkmike9KYTDBGLuNj0R_0Q_FDQdhKr/view?usp=sharing
mkbundled 结果:https://drive.google.com/file/d/13kHG-RxSqfMFlE53wCSe9iqfwOzheKUm/view?usp=sharing
更新:我已经在 mkbundle 问题跟踪器上创建了一张票。 https://bugzilla.xamarin.com/show_bug.cgi?id=60753#bug_status_bottom
得到一位项目所有者的回复migueldeicaza on the github ticket I created:
This is caused by a missing machine.config file in the bundled executable.
Probably we should make it so that mkbundle ships the machine.config as well, in the meantime use:
mkbundle --simple --deps -o foo a.exe --machine-config /etc/mono/4.5/machine.config And the problem is that without automatic shipping of machine.config, developers will struggle with the cross compiler to find the proper path.
先看看我创建的那张工单上的对话,然后你应该知道要更改什么。就我而言,这有效:
MONO_LOG_MASK=asm MONO_LOG_LEVEL=debug mkbundle --simple --static --deps -o ./SpFetcher --config /etc/mono/config --machine-config /etc/mono/4.5/machine.config bin/Release/SpPrefetchIndexBuilder.exe
终于成功了。我针对 ubuntumate 16 构建了它,然后将其移动到没有安装单声道的 ubuntumate 17 机器上,运行 它通过了!