使用mkbundle构建的C#应用​​程序不起作用

时间:2017-11-20 02:01:53

标签: c# .net mono mkbundle

我正在尝试使用MkBundle构建this C# program,以便用户可以在Linux上运行它而无需安装Mono。

但是在尝试使用构建的程序时,我一直收到错误。

重现的步骤:

  1. Git克隆这个项目:
  2. https://github.com/nddipiazza/Sharepoint-Exporter

    1. 从中提取DLL:
    2. https://www.microsoft.com/en-us/download/confirmation.aspx?id=35585 -

      1. 在Solution explorer中,右键单击References - >添加参考 - >浏览.NET程序集 - >添加Microsoft共享点DLL

        • Microsoft.SharePoint.Client.dll
        • Microsoft.SharePoint.Client.Runtime.dll
      2. 构建应用程序。

      3. (或者只是从这里抓取构建的应用程序https://drive.google.com/a/lucidworks.com/file/d/1GPgkmike9KYTDBGLuNj0R_0Q_FDQdhKr/view?usp=sharing

        1. 执行命令
        2. 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
          
          1. 现在运行./SpFetcher程序

            • 在使用Mono的机器上,它可以正常工作。

            • 在没有单声道的计算机上,出现此错误:

            无法识别URI前缀。       在System.Net.WebRequest.Create(System.Uri requestUri,System.Boolean useUriBase)[0x000ae] in< 50d80b08c1a5449282b22aedf03ce925&gt ;:0       在System.Net.WebRequest.Create(System.String requestUriString)[0x00014] in< 50d80b08c1a5449282b22aedf03ce925&gt ;: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 context,System.String requestUrl)[0x00021] in:0       在Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate()[0x0000d] in:0       在Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest()[0x0001f] in:0       在Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()[0x00008]中:0       at SpPrefetchIndexBuilder.SpPrefetchIndexBuilder.getSubWebs(System.String url,System.Collections.Generic.Dictionary`2 [TKey,TValue] parentWebDict)[0x00266] in< 8afd075a89d9457b827aef736e8e1c09&gt ;:0       在SpPrefetchIndexBuilder.SpPrefetchIndexBuilder.Main(System.String [] args)[0x00018] in< 8afd075a89d9457b827aef736e8e1c09>:0

          2. 不期望该错误。

            mkbundle程序无效吗?

            我想要的c#程序mkbundle: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

1 个答案:

答案 0 :(得分:0)

在github migueldeicaza上收到了其中一位项目所有者ticket I created的回复:

  

这是由捆绑中缺少的machine.config文件引起的   可执行文件。

     

可能我们应该这样做,以便mkbundle发布machine.config   同时,在此期间使用:

     

mkbundle --simple --deps -o foo a.exe --machine-config   /etc/mono/4.5/machine.config问题是没有自动   运送machine.config,开发人员将与十字架斗争   编译器找到正确的路径。

首先看看我创建的那张票上的对话,然后你应该知道要改变什么。在我的情况下,这工作:

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机器上,跑了它就过去了!