在Linux中,找不到框架“.NETFramework,Version = v4.5”的引用程序集

时间:2018-06-07 12:39:40

标签: c# .net visual-studio

我已经设置了Visual Studio来编译我的Ubuntu机器中的C#代码。 我将工作区/我的代码加载到VS,我可以看到以下错误。

    The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

请帮我解决这个问题,因为我是Visual Studio的初学者。

由于

2 个答案:

答案 0 :(得分:2)

如果项目很重,你可以关注 this procedure

如果您的项目是轻量级的,请使用VS创建一个新的.netcore项目,并将您的代码(和依赖项引用)移动到该新项目中。然后让VS告诉你潜在的错误并纠正它们。

查看该过程,您可以首先在dotnet 4.6.2框架中重新定位您的实际项目,以“确保在.NET Core无法支持的情况下您可以使用.NET替代.NET Framework特定目标特定的API。“

答案 1 :(得分:0)

如果有的话,我建议在Visual Studio 2017中运行可移植性工具。如果您很难移动它,这将给您一个想法。

对于csproj的错误,这是因为该文件中包含路径,这些路径指向使用Windows路径而不是Linux路径的位置。