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 build3 cannot build desktop framework project migrated from project.json

See original GitHub issue

Steps to reproduce

  1. dotnet new
  2. Update project.json to target net45 instead of netcoreapp1.0
  3. dotnet migrate
  4. dotnet restore3
  5. dotnet build3

Expected behavior

The build should succeed. Note that dotnet build works just fine.

Actual behavior

The build fails. This is the build output, with the repeated errors at the end of the output removed:

Microsoft (R) Build Engine version 15.1.0.0
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 10/6/2016 10:11:08 AM.
Project "C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj" on node 1 (Build target(s)).
Project "C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj" (1) is building "C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj" (1:2) on node 1 (Build target(s)).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
GenerateAssemblyInfo:
Skipping target "GenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
CoreCompile:
  C:\users\jver\desktop\dotnet\1.0.0-preview3-003770\sdk\1.0.0-preview3-003770\RunCsc.cmd /noconfig /nowarn:1701,1701,1702 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:DEBUG;TRACE;DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll" /debug+ /debug:portable /filealign:512 /nologo /optimize- /out:obj\Debug\net45\desktopxtarget.dll /subsystemversion:6.00 /target:exe /utf8output /deterministic+ Program.cs "C:\Users\jver\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs" obj\Debug\net45\desktopxtarget.AssemblyInfo.cs
C:\Users\jver\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs(4,35): error CS0234: The type or namespace name 'Versioning' does not exist in the namespace 'System.Runtime' (are you missing an assembly reference?) [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(6,19): error CS0234: The type or namespace name 'Reflection' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(7,19): error CS0234: The type or namespace name 'Reflection' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(8,19): error CS0234: The type or namespace name 'Reflection' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(9,19): error CS0234: The type or namespace name 'Reflection' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(10,19): error CS0234: The type or namespace name 'Reflection' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(11,19): error CS0234: The type or namespace name 'Reflection' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(12,19): error CS0234: The type or namespace name 'Resources' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
C:\Users\jver\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs(4,71): error CS0518: Predefined type 'System.String' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
C:\Users\jver\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs(4,101): error CS0246: The type or namespace name 'FrameworkDisplayName' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
C:\Users\jver\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs(4,124): error CS0518: Predefined type 'System.String' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(6,61): error CS0518: Predefined type 'System.String' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(7,59): error CS0518: Predefined type 'System.String' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(8,68): error CS0518: Predefined type 'System.String' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(9,55): error CS0518: Predefined type 'System.String' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(10,53): error CS0518: Predefined type 'System.String' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(11,55): error CS0518: Predefined type 'System.String' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(12,54): error CS0518: Predefined type 'System.String' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
C:\Users\jver\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs(3,14): error CS0234: The type or namespace name 'Reflection' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
obj\Debug\net45\desktopxtarget.AssemblyInfo.cs(4,14): error CS0234: The type or namespace name 'Reflection' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
Program.cs(3,7): error CS0518: Predefined type 'System.Object' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
Program.cs(5,22): error CS0518: Predefined type 'System.String' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
Program.cs(5,12): error CS0518: Predefined type 'System.Void' is not defined or imported [C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj]
Done Building Project "C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj" (Build target(s)) -- FAILED.
Done Building Project "C:\Users\jver\Desktop\desktopxtarget\desktopxtarget.csproj" (Build target(s)) -- FAILED.

Build FAILED.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview2-003131)

Product Information:
 Version:            1.0.0-preview2-003131
 Commit SHA-1 hash:  635cf40e58

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64

My project.json

{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  },
  "dependencies": {},
  "frameworks": {
    "net45": {}
  }
}

My .csproj

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
  <PropertyGroup>
    <OutputPath>bin\$(Configuration)</OutputPath>
  </PropertyGroup>
  <PropertyGroup>
    <VersionPrefix>1.0.0</VersionPrefix>
    <TargetFrameworks>net45</TargetFrameworks>
    <DebugType>portable</DebugType>
    <AssemblyName>desktopxtarget</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
    <AutoUnify>true</AutoUnify>
    <DesignTimeAutoUnify>true</DesignTimeAutoUnify>
    <ProjectLockFile>$(MSBuildProjectDirectory)/project.lock.json</ProjectLockFile>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="**\*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
    <EmbeddedResource Include="**\*.resx" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
    <EmbeddedResource Include="compiler\resources\**\*" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
    <PackageReference Include="Microsoft.NETCore.Sdk">
      <Version>1.0.0-alpha-20160930-1</Version>
    </PackageReference>
  </ItemGroup>
  <PropertyGroup Condition=" '$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion)' == '.NETFramework,Version=v4.5' ">
    <DefineConstants>$(DefineConstants);NET45</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DefineConstants>$(DefineConstants);RELEASE;TRACE</DefineConstants>
    <Optimize>true</Optimize>
  </PropertyGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
eerhardtcommented, Oct 7, 2016

We can add them to the SDK as necessary. But until then, I think dotnet migrate should do it.

It will be harder to take them out of the SDK than it would be to take them out of dotnet migrate.

0reactions
eerhardtcommented, Oct 8, 2016

This is fixed with the latest SDK. Closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to convert a .net framework (not core) project from ...
I have an existing set of .net Framework projects (.csproj webapi) that need to be converted to the modern non project.json formats.
Read more >
Migrate from ASP.NET Core 3.1 to 5.0
Learn how to migrate an ASP.NET Core 3.1 project to ASP.NET Core 5.0.
Read more >
Menu
Problem In order to create a date time and build number stamp into an output build package as part of a Jenkins build...
Read more >
Using Visual Builder Studio
access Git repositories from your computer. However, you cannot access projects, issues, and builds from a Git client. Git Command-Line Interface.
Read more >
conda-build Documentation
Conda-build contains commands and tools to use conda to build your own packages. It also provides helpful tools to.
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