question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet build fails for all frameworks besides net451

See original GitHub issue

Steps to reproduce

dotnet new

modify the project.json to look like this:

{ "version": "1.0.0-*", "compilationOptions": { "emitEntryPoint": true }, "dependencies": { }, "frameworks": { "net451" :{}, "net35": {}, "dnxcore50": {}, "dotnet5.0": {}, "netstandard1.0": {} } }

run dotnet restore

run each of these:

dotnet build --framework net451 dotnet build --framework net35 dotnet build --framework dnxcore50 dotnet build --framework dotnet5.0 dotnet build --framework netstandard1.0

Expected behavior

Each build succeeds.

Actual behavior

The net451 build succeeds but every other build command fails with this output (where the framework version in the path is respective to each build):

Compiling test for .NETStandard,Version=v1.0
C:\Program Files\dotnet\dotnet.exe compile-csc @C:\Users\achapman\Desktop\test\obj\Debug\netstandard1.0\dotnet-compile.rsp returned Exit Code 1
C:\Users\achapman\Desktop\test\obj\Debug\netstandard1.0\dotnet-compile.assemblyinfo.cs(2,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\achapman\Desktop\test\obj\Debug\netstandard1.0\dotnet-compile.assemblyinfo.cs(3,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\achapman\Desktop\test\obj\Debug\netstandard1.0\dotnet-compile.assemblyinfo.cs(4,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\achapman\Desktop\test\obj\Debug\netstandard1.0\dotnet-compile.assemblyinfo.cs(5,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\achapman\Desktop\test\obj\Debug\netstandard1.0\dotnet-compile.assemblyinfo.cs(2,58): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\achapman\Desktop\test\obj\Debug\netstandard1.0\dotnet-compile.assemblyinfo.cs(3,54): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\achapman\Desktop\test\obj\Debug\netstandard1.0\dotnet-compile.assemblyinfo.cs(4,67): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\achapman\Desktop\test\obj\Debug\netstandard1.0\dotnet-compile.assemblyinfo.cs(5,62): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\achapman\Desktop\test\Program.cs(1,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\achapman\Desktop\test\Program.cs(5,18): error CS0518: Predefined type 'System.Object' is not defined or imported
C:\Users\achapman\Desktop\test\Program.cs(7,33): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\achapman\Desktop\test\Program.cs(7,23): error CS0518: Predefined type 'System.Void' is not defined or imported

Compilation failed.
    0 Warning(s)
    12 Error(s)

Time elapsed 00:00:01.8160005

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-beta-002202)

Product Information: Version: 1.0.0-beta-002202 Commit Sha: 60b23d5115

Runtime Environment: OS Name: Windows OS Version: 6.1.7601 OS Platform: Windows RID: win7-x64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
nuevoalexcommented, Apr 4, 2016

I don’t think this should be closed given that information.

I have no idea why I’m adding that dependency and even with it added back the other frameworks will not build.

You are missing dependencies required by the other frameworks.

What dependencies?

Why are those now required as explicit dependencies when the previous behavior of dnu and visual studio was to implicitly provide them?

Why does net451 magically work if I must explicitly require core libraries as dependencies now?

0reactions
blackdwarfcommented, Apr 7, 2016

@nuevoalex wait; are you saying that you are seeing dotnet build fail after dotnet restore even on a plain, “vanilla” dotnet new project?

My comment was more to the point that behaviors will be different with the CLI than what was done with DNX/DNU/DNVM. Docs are currently in PR in the dotnet/core-docs repo and they contain DNX->CLI migration document that explains how to move between these two worlds.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet build fails on solution with .net framework project ...
When I build the same solution using "dotnet build" (it is what is used in the CI pipeline) all the projects executes and...
Read more >
'dotnet build' error after migrating dotnetcore project to 1.0.4
NET Framework >= 4.0, reference assemblies are installed and no special targets / tasks are used. In your case, you tried to compile...
Read more >
Troubleshoot .NET Framework targeting errors
To resolve the error, make sure that your application targets a .NET version that's compatible with the version that's targeted by the projects ......
Read more >
.NET core vs .NET framework
Wondering about the difference between .NET Core & .NET Framework? Here's a quick guide on how to pick the right runtime environment for...
Read more >
dotnet build command - .NET CLI
The dotnet build command builds a project and all of its dependencies.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found