2016-06-06 44 views
1

我想将我的网站从dotnet核心rc1迁移到dotnet核心rc2,但是我遇到了一个错误,然后我尝试运行一个小测试,但它也没有为我工作。 这是我的睾丸中:https://github.com/ricardoalcantara/WebApplicationBasic在Linux上使用net451的asp.net-core MVC rc2

我的环境是:

  • 的Debian 8.4
  • 单4.2.3
  • DOTNET 1.0.0-preview1-002702

我需要在“框架”之上运行它:“net451”,因为我的主项目需要很少的库,它仍然只在该平台上运行,所以我正在使用此命令行运行:

dotnet run --framework .NETFramework,Version=v4.5.1 

实际上它运行,但是当我尝试访问本地主机:5000主要抛出一个长堆栈错误与消息:

z2cw6v06.4ja(43,10): error CS0518: Predefined type 'System.Object' is not defined or imported 
z2cw6v06.4ja(43,50): error CS0012: The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 
z2cw6v06.4ja(43,10): error CS0518: Predefined type 'System.Void' is not defined or imported 
z2cw6v06.4ja(45,10): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 
z2cw6v06.4ja(45,10): error CS0518: Predefined type 'System.Object' is not defined or imported 
z2cw6v06.4ja(45,50): error CS0012: The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 
z2cw6v06.4ja(45,10): error CS0518: Predefined type 'System.Void' is not defined or imported 
z2cw6v06.4ja(47,10): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 
z2cw6v06.4ja(47,10): error CS0518: Predefined type 'System.Object' is not defined or imported 
z2cw6v06.4ja(47,50): error CS0012: The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 

有人可以帮我解决这个问题?

Obs .:它适用于Windows。

+0

尝试'DOTNET运行--framework net451' –

+0

还不行,但我相信我找到了一个解决办法,以暂时解决这个问题。我会在测试完成后更新它。 –

回答

0

如果你仔细观察,错误似乎是MVC未能编译视图:

Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException: One or more compilation failures occurred: 
pufduf6v.a1v(17,88): error CS1980: Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference? 
pufduf6v.a1v(17,88): error CS0518: Predefined type 'System.Boolean' is not defined or imported 
pufduf6v.a1v(17,47): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 
… 

但运行dotnet publish,然后执行直接使用mono对我的作品,如结果(在Ubuntu):

mono bin/Debug/net451/ubuntu.14.04-x64/publish/WebApplicationBasic.exe 

As was already explained to you on Github, this seems to be a known issue.

+0

我已经明白这是一个已知的问题,但我正在寻找一种方法来使其工作。我正在测试一个可能的解决方案,当我完成后我会更新它是否完全解决了我的问题。 –