用Mono编译:System.IO.FileSystem,Version = 4.0.2.0 - >系统找不到指定的文件

问题描述 投票:0回答:1

我正在尝试使用Mono命令提示符x64编译一个名为ChatDaemon的程序(使用Visual Studio 2017,在C#中编码,在Windows 8.0计算机上)。 Mono编译器在失败时提供以下错误报告:

无法加载文件或程序集'System.IO.FileSystem,Version = 4.0.2.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一。该系统找不到指定的文件。 (TaskId:24)C:\ Program Files \ Mono \ lib \ mono \ msbuild \ 15.0 \ bin \ Roslyn \ Microsoft.CSharp.Core.targets(84,5):错误MSB6006:“csc.exe”已退出,代码为1 。

经过几个小时的研究后,我将这些行插入到ChatDaemon.csproj中,但无济于事:

<PropertyGroup>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>

我已经将以下行插入到ChatDaemon的App.config文件中,也无济于事。

<dependentAssembly>
    <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.3.0" newVersion="4.3.0" />
</dependentAssembly>

我使用的是以下版本的.NET Framework,如ChatDaemon.csproj文件中所示:

  <ItemGroup>
    <BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
          <Visible>False</Visible>
      <ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
  </ItemGroup>

我还在ChatDaemon.csproj文件中找到了与System.IO.FileSystem.dll文件有关的这段代码:

<Reference Include="System.IO.FileSystem">
  <HintPath>..\..\..\..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\system.io.filesystem\4.3.0\ref\net46\System.IO.FileSystem.dll</HintPath>
</Reference>

我该如何解决此错误?如果需要更多信息,请告诉我,我会尽快遵守。

c# mono
1个回答
0
投票

尝试改变

> <HintPath>..\..\..\..\..\..\..\Program
> Files\dotnet\sdk\NuGetFallbackFolder\system.io.filesystem\4.3.0\ref\net46\System.IO.FileSystem.dll</HintPath>

到标准的.NET .dll 这个问题可能是由Nuget包引起的。根据this site的说法,System.IO.FileSystem-package中的文件没有版本化为4.3.0。

<Reference Include="system.io.filesystem">
    </Reference>

或者,您可以尝试使用nuget包的其他子文件夹中的Filesystem-dlls,具体取决于您使用的Framework。 (例如NuGetFallbackFolder \ System.IO.FileSystem.4.3.0 \ lib \ net46)

© www.soinside.com 2019 - 2024. All rights reserved.