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.

Warning MSB4011: "Microsoft.CSharp.targets" cannot be imported again.

See original GitHub issue

Steps to reproduce

dotnet build

Expected behavior

No build warnings

Actual behavior

C:\Program Files\dotnet\sdk\2.0.3\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.targets(41,3): warning MSB4011: “C:\Program Files\dotnet\sdk\2.0.3\Microsoft.CSharp.targets” cannot be imported again. It was already imported at “C:\Projects\SomeProject.csproj (106,3)”. This is most likely a build authoring error. This subsequent import will be ignored.

Environment data

dotnet --info output: .NET Command Line Tools (2.0.3)

Product Information: Version: 2.0.3 Commit SHA-1 hash: 12f0c7efcc

Runtime Environment: OS Name: Windows OS Version: 6.1.7601 OS Platform: Windows RID: win7-x64 Base Path: C:\Program Files\dotnet\sdk\2.0.3\

Microsoft .NET Core Shared Framework Host

Version : 2.0.3 Build : a9190d4a75f4a982ae4b4fa8d1a24526566c69df

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:30 (14 by maintainers)

github_iconTop GitHub Comments

livarcocccommented, Jan 11, 2018

This is what a regular console app csproj file looks like:

<Project Sdk="Microsoft.NET.Sdk">



With this, I don’t see the error you are mentioning above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

msbuild - *.targets cannot be imported again. It was already ...
I have UWP app build in VS 2017 and many project in my solution have build warning like below. How to get rid...
Read more >
MSB4011 - MSBuild
This diagnostic code is emitted when you import the same project more than once in the same project file. ... 'project' cannot be...
Read more >
MSB4011 - Terje Sandstrom
Issue with MSB4011 warnings. If MSB4011 warnings appears on every project you have, and you get “tons” of them, ... NuGet.targets" cannot be...
Read more >
targets and props warning about cannot be imported again
I get a lot of these, and not sure why they're coming. I have them only on one machine, but I cant figure...
Read more >
"Microsoft.CSharp.targets" cannot be imported again.
Warning MSB4011 : "Microsoft.CSharp.targets" cannot be imported again. · Steps to reproduce · Expected behavior · Actual behavior · Environment data.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found