'dotnet build' targeting net452 errors on CI build server
Steps to reproduce
- Use
dotnet-install.ps1(1.0.0-preview2 version) to install latest on CI server.
>dotnet-install.ps1 -Version Latest -Channel Preview -Architecture x86
- Create new sample project in folder named 'dotnetnewtest'
>dotnet new
- Test restore and build (with project.json still targeting 'netcoreapp1.0')
>dotnet restore
>dotnet build
Results:
Compiling dotnetnewtest for .NETCoreApp,Version=v1.0
Compilation succeeded.
- Change target by updating the
frameworksnode in project.json (full project.json below)
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"net452": {
}
}
}
- Delete lock file, restore & build
>del project.lock.json
>dotnet restore
>dotnet build
Results:
Project dotnetnewtest (.NETFramework,Version=v4.5.2) will be compiled because expected outputs are missing
Compiling dotnetnewtest for .NETFramework,Version=v4.5.2
C:\Users\myUsername\AppData\Local\Microsoft\dotnet\dotnet.exe compile-csc @C:\do
tnetnewtest\obj\Debug\net452\dotnet-compile.rsp returned Exit Code 1
C:\dotnetnewtest\obj\Debug\net452\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:\dotnetnewtest\obj\Debug\net452\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:\dotnetnewtest\obj\Debug\net452\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:\dotnetnewtest\obj\Debug\net452\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:\dotnetnewtest\obj\Debug\net452\dotnet-compile.assemblyinfo.cs(2,58): error
CS0518: Predefined type 'System.String' is not defined or imported
C:\dotnetnewtest\obj\Debug\net452\dotnet-compile.assemblyinfo.cs(3,54): error
CS0518: Predefined type 'System.String' is not defined or imported
C:\dotnetnewtest\obj\Debug\net452\dotnet-compile.assemblyinfo.cs(4,67): error
CS0518: Predefined type 'System.String' is not defined or imported
C:\dotnetnewtest\obj\Debug\net452\dotnet-compile.assemblyinfo.cs(5,62): error
CS0518: Predefined type 'System.String' is not defined or imported
C:\dotnetnewtest\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:\dotnetnewtest\Program.cs(5,18): error CS0518: Predefined type 'System.Object' is not defined or imported
C:\dotnetnewtest\Program.cs(7,33): error CS0518: Predefined type 'System.String' is not defined or imported
C:\dotnetnewtest\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:02.0073775
Expected behavior
The application builds without error. (Note: I am using this simplified app to help communicate the problem--I originally found this issue (and still have it) with my real-world web app that I am migrating from DNX-based scripts to RC2.)
Actual behavior
Errors as listed in the 'Steps to reproduce' section. Such as:
C:\dotnetnewtest\obj\Debug\net452\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?)
Environment data
dotnet --info output:
.NET Command Line Tools (1.0.0-preview2-003104)
Product Information:
Version: 1.0.0-preview2-003104
Commit SHA-1 hash: ec585d1419
Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x86
Well early signs are pointing to the fact that the CI server does not have the .NET Framework 4.5.2 SDK installed. As a test, I updated the project.json file to target "net451" (the 4.5.1 SDK is installed on the CI server) and that passed dotnet build. It's late now so I'll look to install the 4.5.2 SDK tomorrow and report results.
Installing the .Net 4.5.2 SDK on the CI server fixed this issue.
what is the issue that you are seeing?
Apologies. Commented on the wrong post.