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.

Bug: WinFX.targets was not found

See original GitHub issue

From @HamedMasafi on December 25, 2018 8:31

I have installed dotnet core 3 preview on opensuse leap 15.0 The file that I downloaded is: https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-3.0.100-preview-009812-linux-x64-binaries

I’ve try to build an app:

hamed@linux-f1fa:~/tmp/> mkdir -p dwin && cd dwin
hamed@linux-f1fa:~/tmp/dwin> /opt/apps/dotnet/dotnet new winforms       

Welcome to .NET Core!
---------------------
Learn more about .NET Core: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

Telemetry
---------
The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

ASP.NET Core
------------
Successfully installed the ASP.NET Core HTTPS Development Certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). For establishing trust on other platforms refer to the platform specific documentation.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
Getting ready...
The template "Windows Forms Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /home/hamed/tmp/dwin/dwin.csproj...
  Restoring packages for /home/hamed/tmp/dwin/dwin.csproj...
  Installing Microsoft.NETCore.DotNetAppHost 3.0.0-preview-27122-01.
  Installing Microsoft.NETCore.DotNetHostResolver 3.0.0-preview-27122-01.
  Installing NETStandard.Library 2.0.3.
  Installing Microsoft.NETCore.DotNetHostPolicy 3.0.0-preview-27122-01.
  Installing Microsoft.NETCore.Platforms 3.0.0-preview.18571.3.
  Installing Microsoft.NETCore.Platforms 2.0.0.
  Installing Microsoft.NETCore.Targets 2.0.0.
  Installing Microsoft.NETCore.App 3.0.0-preview-27122-01.
  Installing Microsoft.WindowsDesktop.App 3.0.0-alpha-27128-4.
  Installing runtime.linux-x64.Microsoft.NETCore.DotNetAppHost 3.0.0-preview-27122-01.
  Installing runtime.linux-x64.Microsoft.NETCore.DotNetHostResolver 3.0.0-preview-27122-01.
  Installing runtime.linux-x64.Microsoft.NETCore.DotNetHostPolicy 3.0.0-preview-27122-01.
  Installing runtime.linux-x64.Microsoft.NETCore.App 3.0.0-preview-27122-01.
  Generating MSBuild file /home/hamed/tmp/dwin/obj/dwin.csproj.nuget.g.props.
  Generating MSBuild file /home/hamed/tmp/dwin/obj/dwin.csproj.nuget.g.targets.
  Restore completed in 4.87 min for /home/hamed/tmp/dwin/dwin.csproj.

Restore succeeded.
hamed@linux-f1fa:~/tmp/dwin> /opt/apps/dotnet/dotnet run
/opt/apps/dotnet/sdk/3.0.100-preview-009812/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.targets(14,2): error MSB4019: The imported project "/opt/apps/dotnet/sdk/3.0.100-preview-009812/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.WinFX.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [/home/hamed/tmp/dwin/dwin.csproj]

The build failed. Please fix the build errors and run again.

The file exists but in other case:

/opt/apps/dotnet/sdk/3.0.100-preview-009812/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.WinFx.targets

The ‘x’ on WinFx is lower but dotnet expect to it be upper.

I’ve created a copy with this command but I know is not good way for solving bugs

cp /opt/apps/dotnet/sdk/3.0.100-preview-009812/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.WinF{x,X}.targets

Copied from original issue: dotnet/coreclr#21673

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

21reactions
livarcocccommented, Dec 26, 2018

We don’t support compiling winforms and wpf outside of windows. This is by design.

3reactions
AidanMcKcommented, May 10, 2020

The causes problem on Mac OS X case-sensitive systems also. Making symlinks for both the target and the props file to the correct case is a workaround (not a fix).

e.g.

cd /usr/local/share/dotnet/sdk/3.1.200/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets
sudo ln -s Microsoft.WinFx.targets Microsoft.WinFX.targets
sudo ln -s Microsoft.WinFx.props Microsoft.WinFX.props

Read more comments on GitHub >

github_iconTop Results From Across the Web

MSBuild Fails On C# WPF Application Project
I was having a similar error (BG1002: File not found) with a VS2017 WPF project which won't built because a certain icon file...
Read more >
How Do I Repair Microsoft.WinFX.targets Errors? - Solvusoft
Microsoft.WinFX.targets problems include application errors, missing files, and possible virus infection. Here are the top five most common Microsoft.
Read more >
Issue Migrating friom 4.8 to 6.0 - Microsoft Q&A
The project is a wpf desktop application. I only get one bad error: Unknown build error, 'Could not find type 'System.Web. ... WinFX.targets....
Read more >
WPF apps fail to compile after updating to
WinFX.targets(225,9): error MC1000: Unknown build error, 'Could not find assembly 'mscorlib, Version=2.0.5.0, Culture=neutral ...
Read more >
Could not copy xxx.csproj.nuget.dgspec.json - Build/Test ...
WPF project build error - Could not copy xxx.csproj.nuget.dgspec.json: After installing VS 2022 RC & NCrunch v4.10 I get the following error message: ......
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