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



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

无法加载文件或程序集"System.IO.FileSystem,版本=4.0.2.0,区域性=中性,公钥令牌=b03f5f7f11d50a3a"或其依赖项之一。系统找不到指定的文件。(任务 ID: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 FilesdotnetsdkNuGetFallbackFoldersystem.io.filesystem4.3.0refnet46System.IO.FileSystem.dll</HintPath>
</Reference>

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

尝试更改

> <HintPath>..............Program
> FilesdotnetsdkNuGetFallbackFoldersystem.io.filesystem4.3.0refnet46System.IO.FileSystem.dll</HintPath>

到标准 .NET .dll
此问题可能是由 Nuget 包引起的。根据本网站,System.IO.FileSystem-package中的文件未版本为4.3.0。

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

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

最新更新