我在一堆.NET Framework项目的解决方案中构建了一个ASP.NET Core项目(目标框架为.NET Framework 4.5.2)。我引用了其中一个使用StyleCop.MsBuild的项目。但是,当我做了dotnet build
,我越来越:如何引用ASP.NET Core(.NET Framework定向)项目中的旧程序集?
C:\MySolution\nupkgs\StyleCop.MSBuild.4.7.54.0\build\StyleCop.MSBuild.Targets(101,5): error MSB4062: The "StyleCopTask" task could not be loaded from the assembly
C:\MySolution\nupkgs\StyleCop.MSBuild.4.7.54.0\build\..\tools\StyleCop.dll. Could not load file or assembly 'System.Windows.Forms, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its
dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [
C:\MySolution\src\MyProject\MyProject.csproj]
哪里MyProject
是我想引用该项目。
我试过包括System.Windows.Forms
作为依赖,但它的版本是4.0.0.0而不是2.0.0.0,所以这似乎没有工作。
反正有参考System.Windows.Forms
得到这个建立?
AFAICT这里的适当解决方案是升级'StyleCop.MsBuild'以支持.Net Framework/Core的现代版本。 – Thebluefish