dotnet build fails for all frameworks besides net451
See original GitHub issueSteps 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:
- Created 7 years ago
- Comments:7 (2 by maintainers)
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.
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?
@nuevoalex wait; are you saying that you are seeing
dotnet build
fail afterdotnet 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.