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
Each build succeeds.
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
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
You are missing dependencies required by the other frameworks.
Also, did you remove the dependency entry that dotnet new puts in the project.json:
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-23931"
}
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?
I should also mention I'm using the specific example of the dotnet new project, but can repro this behavior with all of my existing real world projects.
Specifically they fail to find all of my dependencies while dnu build and visual studio builds work perfectly.
@blackdwarf Can you give pointers to where to find this information?
@livarcocc I'm workin on the docs that explain how to change things. But, in general, this new world is different from DNX.
@blackdwarf
I'm workin on the docs that explain how to change things. But, in general, this new world is different from DNX.
I can't really do much with this information.
To be super clear. When I run dotnet build either from the base project created using dotnet new OR from my existing projects it does not find ANY of the dependencies I use in the project, whether they are required in my project.json or not.
I submitted this subset of the issue to try and simplify the error case and make it easily reproduce-able. This is a bug unless there is truly a vastly different setup for all projects in this new world.
If so that's fine but the documentation stating so and explaining how to migrate isn't optional in my opinion if this has been released to the world.
@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.
Most helpful comment
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?