Reputation: 8651
Clean Windows Server 2016 machine, I installed:
Build Tools for Visual Studio 2017 (https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15)
.NET Framework 4.5.2 Developer Pack (https://www.microsoft.com/net/download/thank-you/net452-developer-pack)
I got the following error message from MSBuild:
[GetReferenceAssemblyPaths] C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(1124, 5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
How can I solve this?
Thanks.
EDIT: Trying to install .NET Framework 4.5 I get this error:
Microsoft .NET Framework 4.5 is already a part of this operating system. You do not need to install the .NET Framework 4.5 redistributable.
Same or higher version of .NET Framework 4.5 has already been installed on this computer.
Trying to install .NET Framework 4.5.2 I get this error:
.NET Framework 4.5.2 or a later update is already installed on this computer.
Upvotes: 0
Views: 3195
Reputation: 4730
When you install Visual Studio Build Tools 2017, you can choose components to install. If you run vs_buildtools.exe
from cmd
, it only installed minimal MSBuild toolset.
You can choose components to install via GUI:
Also, you can install particular component or workload via cmd
:
vs_buildtools.exe --add Microsoft.Net.Component.4.5.TargetingPack --passive
You can find workloads and component names here: Visual Studio Build Tools 2017 component directory
Detailed info about command-line parameters are here: Use command-line parameters to install Visual Studio 2017
You can consider installing only workloads required for you (with recommended components):
vs_buildtools.exe --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.WebBuildTools --includeRecommended --passive
or all of them
vs_buildtools.exe --allWorkloads --includeRecommended --passive
You can use --quiet --wait
keys instead of --passive
to make installation silent.
Upvotes: 1
Reputation: 76770
Cannot build Visual Studio 2017 project on a clean machine
You can not install the .NET framework 4.5 on that machine, because you have a higher version of .NET framework 4.5.2 installed.
To resolve this issue, you can retarget the project to 4.5.2 or you can uninstall the .NET framework 4.5.2 and install the .NET framework 4.5.
Install .NET Framework 4 (or 4.6) in Windows Server 2016
Upvotes: 0
Reputation: 809
Upvotes: 0
Reputation: 49988
It looks like you are running MSBuild
from the wrong directory:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\amd64\
Try and run MSBuild.exe from the bin
instead and see if that works:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin
Upvotes: 0