alphacoder
alphacoder

Reputation: 573

Namespace or type specified in the project-level Imports 'System.Threading.Tasks' doesn't contain any public member or cannot be found

Is there a way to resolve this below warning message. Project is not referring the System.Threading anywhere but still I get this below error message. Only difference is that, The Project's solution has around 50 plus projects, some are written in C# and some are in VB. few project targets 4.5 framework and few targets 3.0 framework.

Namespace or type specified in the project-level Imports 'System.Threading.Tasks' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

Upvotes: 1

Views: 2981

Answers (2)

Windows R.O.G
Windows R.O.G

Reputation: 1

How I Solved the Issue:

  1. Open your project solution > Solution Explorer.
  2. Select your project and double-click it until a new tab appears showing the blue and white code editor.
  3. Scroll and search for the code wrapped in <ItemGroup>, then remove the <Import Include="ole" />. Example:
    <ItemGroup>
    <Import Include="System.Data" />
    <Import Include="ole" />(Remove it)
    <Import Include="System.Data.Common" />
    <Import Include="System.Data.Odbc" />
    <Import Include="System.Data.OleDb" />
    <Import Include="System.Drawing" />
    <Import Include="System.Windows.Forms" />
    </ItemGroup>
  1. Then, in VB.NET, click on the Build tab > Clean Solution, then click Rebuild Solution again. This resolved my issue.

Upvotes: 0

Scott Chamberlain
Scott Chamberlain

Reputation: 127553

One of your 3.0 VB projects is importing System.Threading.Tasks in a project setting, The namespace System.Threading.Tasks was not introduced till .NET 4.0.

Find the place that has it incorrectly added and remove it.

Upvotes: 1

Related Questions