-1

I am trying to compile the source code for HandyControls. The instructions provide two options:

1.) Compile source code. Please confirm that your development environment meets the requirements before compiling.

Visual Studio 2019
.Net greater than or equal to 5.0.100

Open HandyControl.sln and select the specified environment to compile in the Solution Configuration drop-down box:
    Debug: Release
    HandyControlDemo_Net_GE45 > Framework (netcoreapp 3.0) > netcoreapp3.0

2.) Compile source code with Powershell Go to Build folder and open Powershell here, then execute this command .\build.ps1

My first attempt with Visual Studio 2019 resulted in more than 3,000 errors. After some research, I determined that 60% of the errors were due to C# 10: File-scoped namespaces, but I was using VS 2019ce, so I switched to VS 2022ce. This reduced the errors down to 3:

2>C:\Program Files\dotnet\sdk\7.0.305\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(376,5):

error NETSDK1073: The FrameworkReference 'Microsoft.NETCore.App' was not recognized

2>C:\Program Files\dotnet\sdk\7.0.305\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(376,5):

error NETSDK1073: The FrameworkReference 'Microsoft.WindowsDesktop.App.WPF' was not recognized

2>C:\Program Files\dotnet\sdk\7.0.305\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(376,5): error NETSDK1073:

The FrameworkReference 'Microsoft.WindowsDesktop.App' was not recognized

The Microsoft documentation for the error, NETSDK1073, is located here and reads as follows: This error typically means there is a version of a particular FrameworkReference that the SDK cannot find. Try deleting your obj and bin folders and running dotnet restore to redownload the latest targeting packs.

I found the following associated StackOverflow article that attempts to address the issue: NETSDK1073: The FrameworkReference 'Microsoft.AspNetCore.App' was not recognized

I tried all of the suggestions, leading to no resolution.

Along the way I have downloaded the runtime and sdk for .NET 7.0, 5.0 and .NET Core 3.0.

I added Microsoft.WindowsDesktop.App.WPF as a dependency in the Class Library.

I have exhausted all avenues that I could think of an would appreciated any assistance that anyone would be able to provide. Thanks.

Ananize Scott
  • 901
  • 1
  • 8
  • 11
  • You are supposed to run the `build/build.ps1` build script after you have opened the `HandyControl.sln` in Visual Studio and selected the environment to compile. Did you do this, i.e. run the build script in Powershell? Which source code repo/branch did you clone/download? – mm8 Jul 07 '23 at 11:50
  • Also make sure that you have installed the `.NET desktop development` workload in Visual Studio. – mm8 Jul 07 '23 at 11:51
  • Thank you for responding to my question. When I initially read the documentation, I understood the two references to "Compile source code" as two separate options. It does not say Step 1, Step 2, but that appears to be the case. I also realized that there are two HandyControl repositories in the "ghost1372" GitHub, the original and the one that was modified to contain additional controls. Since I used VS 2022 to set the environment, I made certain I used Developer Powershell for VS 2022 to complete the build. I got both versions up and running. Thanks, you so much for your help! Happy coding! – Ananize Scott Jul 08 '23 at 00:42

1 Answers1

0

With the help of "mm8" (see comments), I was able to resolve the problem. For anyone wishing to compile the source code here are my notes:

  1. Make sure that you have installed the .NET desktop development workload in Visual Studio 2022.

  2. Select which version you want to download. The original version named HandyControl is located here. The modified version named HandyControls (note the plural) that contains additional controls is located here.

  3. Once you have downloaded the code, right click on the folder, select properties, check "Unblock", click "Apply" then click "Ok".

  4. Using VS 2022 open the solution.

  5. Change "Debug" to "Release". In the solution explorer window, Right-Click on "HandyControlDemo_Net_GE45". Click "Set as the Startup Project". Return to the tool-bar and select the dropdown arrow to the right of the second "HandyControlDemo_Net_GE45". Select "Framework (netcoreapp3.0)". Look to the left and make certain "netcoreapp3.0" is checked.

  6. Bring up "Developer PowerShell for VS 2022". (I opened it as Admin, not certain if this is needed). Use the Set_Location Powershell command to set the path of the "build" folder.

Example: Set-Location -Path "C:\PS\WPF HandyControls\HandyControls-develop\build"

  1. Key in the name of the Powershell Build Script and press enter: .\build.ps1

  2. When the application comes up the default language is Chinese. You can change the language by clicking on the settings icon in the upper-top-right corner and select the flag of your choice.

I hope this helps someone, happy coding!

Ananize Scott
  • 901
  • 1
  • 8
  • 11