1

I am trying to migrate my website from dotnet core rc1 to dotnet core rc2, but I faced an error, then I tried to run a small test and it also didn't work for me. This is my teste: https://github.com/ricardoalcantara/WebApplicationBasic

My environment is:

  • Debian 8.4
  • Mono 4.2.3
  • dotnet 1.0.0-preview1-002702

I need to run it on top of the "framework": "net451" because my main project needs few libs which still just run on that platform, so I am running with this command line:

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

it actually runs, but when I try to access localhost:5000 it throws a long stack error mainly with that message:

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'.

Can someone help me to solve that problem?

Obs.: It works on windows.

2
  • Try dotnet run --framework net451 Commented Jun 7, 2016 at 1:32
  • Still doesn't work, but I believe I found a workaround to temporally fix it. I will update this after I have it tested. Commented Jun 8, 2016 at 17:31

1 Answer 1

0

If you look closely, the error seems to be that MVC is failing to compile the view:

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'.
…

But running dotnet publish and then executing the result directly using mono works for me, e.g. (on 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.

Sign up to request clarification or add additional context in comments.

1 Comment

I have already understood that it's a known issue, but I am seeking a way to make it work anyway. I am testing a possible solution posted there, when I have it done I will update if it has fully solved my problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.