kpocza / LoWe

Linux on Windows extender
MIT License
244 stars 17 forks source link

Incompatible with .NET 4.7 #14

Open mcandre opened 4 years ago

mcandre commented 4 years ago

I am having trouble finding the directory that contains MSBuild.exe associated with .NET framework version 4.7. I installed netfx-4.7-devpack with Chocolatey, but I don't see where the installer places the package files.

mcandre commented 4 years ago

Update:

I cobbled together a basic PATH entry from a Dockerfile on Stack Overflow.

PS> where.exe msbuild
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe

My compilation log shows an inability to find .NET 4.6. (4.7 is installed.)

PS C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer> .\build

C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer>tools\nuget restore
MSBuild auto-detection: using msbuild version '4.0' from 'C:\Windows\Microsoft.NET\Framework\v4.0.30319'.
All packages listed in packages.config are already installed.

C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer>msbuild /p:Configuration=Release
Microsoft (R) Build Engine version 16.7.0+b89cb5fde for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 8/13/2020 9:29:07 PM.
Project "C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer\LoWeExposer.sln" on node 1 (de
fault targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|Any CPU".
Project "C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer\LoWeExposer.sln" (1) is buildi
ng "C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer\LoWeExposer\LoWeExposer.csproj" (2)
 on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Microsoft.Common.C
urrentVersion.targets(1177,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.6
 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework
version or retarget your application. You can download .NET Framework Developer Packs at https://aka.
ms/msbuild/developerpacks [C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer\LoWeExposer\
LoWeExposer.csproj]
Done Building Project "C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer\LoWeExposer\LoWe
Exposer.csproj" (default targets) -- FAILED.

Done Building Project "C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer\LoWeExposer.sln"
 (default targets) -- FAILED.

Build FAILED.

"C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer\LoWeExposer.sln" (default target) (1)
->
"C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer\LoWeExposer\LoWeExposer.csproj" (defau
lt target) (2) ->
(GetReferenceAssemblyPaths target) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Microsoft.Common
.CurrentVersion.targets(1177,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4
.6 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framewor
k version or retarget your application. You can download .NET Framework Developer Packs at https://ak
a.ms/msbuild/developerpacks [C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer\LoWeExpose
r\LoWeExposer.csproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.79

C:\Users\andrew\go\src\github.com\kpocza\LoWe\src\LoWeExposer>xcopy LoWeExposer\bin\Release\*.* out /i /y
0 File(s) copied

The README says that the build is expected to work with .NET 4.6 or higher. Sigh.

Workaround

  1. Downgrade to netfx-4.6-devpack.
  2. Ensure its MSBuild.exe is in PATH.
  3. Sign out and back in (esp. for PowerShell).
kpocza commented 4 years ago

Sorry for the inconvenience.

The doc sais that the executable is compatible with .NET 4.6+. As newer .NET Frameworks are (theoretically) backward compatible with the older ones at a certain level.

For building Visual Studio 2015 is mentioned. You can build it by loading the sln or by the build.cmd. Anyway I've just tried to build it with VS 2019, and it works. It depends on the existence of the SDK/Targetting pack.