Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project does not reference framework except that it does

I have a solution which contains multiple projects. All projects target v4.6.1 of the .NETFramework. However when I build my solution and try to run it I get the following exception:

Your project does not reference ".NETFramework,Version=v4.6.1" framework. Add a reference to ".NETFramework,Version=v4.6.1" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.

Can anyone point me in the correct direction? I don't see what is going wrong.

Config1:

<RootNamespace>Exact_Online_Database</RootNamespace>
<AssemblyName>Exact_Online_Database</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>

Config2:

<RootNamespace>ExactOnlineConsoleApp</RootNamespace>
<AssemblyName>ExactOnlineConsoleApp</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>

Config3:

<RootNamespace>Exact_Online_Services</RootNamespace>
<AssemblyName>Exact Online Services</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>

Config4:

<RootNamespace>Example</RootNamespace>
<AssemblyName>Example</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
like image 613
Bart Schelkens Avatar asked May 17 '19 10:05

Bart Schelkens


1 Answers

Deleting the obj folder resolved this issue for me as recommended in Henry He's answer to this question.

For info I came across this issue when I tried to build a project that had been changed to .NET Core (from Framework) on a different branch. When I switched back to a branch with the original framework project it would no longer build.

like image 158
Rob Willis Avatar answered Nov 10 '22 23:11

Rob Willis