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.

Can't build for net46 (net451, net452 works fine)

See original GitHub issue

Steps to reproduce

Use the https://github.com/aspnet/cli-samples/tree/master/HelloMvc sample. Add net46 as the target framework Restore (restores fine) Build (dotnet build -f net46)

Expected behavior

Project builds successfully

Actual behavior

PS C:\Source\cli-samples\HelloMvc> dotnet build -f net46
Project HelloMvc (.NETFramework,Version=v4.6) will be compiled because expected outputs are missing
Compiling HelloMvc for .NETFramework,Version=v4.6
C:\Source\cli-samples\HelloMvc\project.json(15,42): error NU1001: The dependency System.Diagnostics.FileVersionInfo >= 4.0.0-rc2-24027 could not be resolved.
C:\Source\cli-samples\HelloMvc\project.json(15,42): error NU1001: The dependency System.Diagnostics.StackTrace >= 4.0.1-rc2-24027 could not be resolved.
C:\Source\cli-samples\HelloMvc\project.json(15,42): error NU1001: The dependency System.Text.Encoding.CodePages >= 4.0.1-rc2-24027 could not be resolved.
C:\Source\cli-samples\HelloMvc\project.json(15,42): error NU1001: The dependency System.Threading.Thread >= 4.0.0-rc2-24027 could not be resolved.
C:\Source\cli-samples\HelloMvc\project.json(15,42): error NU1001: The dependency System.Xml.XmlDocument >= 4.0.1-rc2-24027 could not be resolved.
C:\Source\cli-samples\HelloMvc\project.json(15,42): error NU1001: The dependency System.Xml.XPath.XDocument >= 4.0.1-rc2-24027 could not be resolved.

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

Time elapsed 00:00:00.0945403

Note when targeting net451 or net452 the project builds just fine.

Environment data

dotnet --info output:

PS C:\Source\cli-samples\HelloMvc> dotnet --info
.NET Command Line Tools (1.0.0-rc2-002670)

Product Information:
 Version:     1.0.0-rc2-002670
 Commit Sha:  f0018642a9

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

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
amanturcommented, Feb 16, 2017

Thanks, @moozzyk. I came back to Core after 8-10 months. It seems I need to go to release notes and docs etc.

1reaction
moozzykcommented, May 5, 2016
  1. It works just fine for net451 and net452
  2. Microsoft.NetCore.App is specific to netcoreapp1.0:
  "frameworks": {
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.0.0-*",
          "type": "platform"
        }
      },
      "imports": [
        "portable-net45+wp80+win8+wpa81+dnxcore50",
        "portable-net451+win8"
      ]
    },
    "net46": {}
  },
  1. If I did not separate Microsoft.NETCore.App - the error I get does not tell me that Microsoft.NETCore.App is causing the problem so the experience is bad.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Open .net framework 4.5 project in VS 2022. Is there any ...
I ran into the same issue after uninstalling Visual Studio 2019. The build worked as expected from Visual Studio and the CLI after...
Read more >
Target frameworks in SDK-style projects - .NET
When you target a framework in an app or library, you're specifying the set of APIs that you'd like to make available to...
Read more >
Multi-targetting .Net Framework and .Net Core in a single project
A 15-second guide and 15-minute walk through. You have a .Net Core project, whether a netstandard library, or a netcore app, and you'd...
Read more >
DocumentFormat.OpenXml 2.20.0
The Open XML SDK provides tools for working with Office Word, Excel, and PowerPoint documents. It supports scenarios such as:
Read more >
Building a project that target .NET Framework 4.5 in Visual ...
Strangely, building from the command line with dotnet build still works fine. OK, fine, I'll just install the targeting pack for .
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