I am getting the following MSB3644 complication error:
The reference assemblies for framework ".NETFramework,Version=v4.0" 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.
From what I've read here, it is due to assemblies on my machine stored in "Program Files" and not in "Program Files (x86)". A FrameworkPathOverride
property on MSBuild can fix it.
I've tried adding this property (FrameworkPathOverride
) to the csproj:
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\tools\common.props" />
<PropertyGroup>
<TargetFrameworks>net40;net45;netstandard1.2</TargetFrameworks>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<FrameworkPathOverride>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0</FrameworkPathOverride>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System.Configuration" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.2' ">
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.2' ">
</ItemGroup>
</Project>
That error then dissapears, but all my types and namespaces cannot be resolved, and I also get this build warning:
MSB3270 There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
After setting the project's target framework to x86, the warning disappears, but still no types or namespaces can resolve.
I have all the necessary frameworks installed:
I am using Visual Studio 2017 on Windows 10.
Got the same error. The framework version was installed alright on my computer (running the installer for this specific version of the framework did nothing - it told me it was already installed). But the framework was not installed "as part of" Visual Studio.
What fixed it for me : Run the VS installer (re-download it from here if you lost it), click "modify" on Visual Studio, go to the "individual components" tab, and check things that are missing under the .NET category.
I didn't set any FrameworkPathOverride on my csproj.