0

Setup :

  • dotnet core 2.2
  • Visual studio code Insiders 1.33.0

VS Code Extensions :

  • C# 1.17.1
  • NuGet Package Manager 1.1.6

For a school project I must use ADO.NET to access the Database. So I added the nuget package System.Data.SqlClient with the nuget extension. Here is the result of my csproj file.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App"/>
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All"/>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.2"/>
    <PackageReference Include="System.Data.SqlClient" Version="4.7.0-preview3.19128.7"/>
    <PackageReference Include="System.Data.Common" Version="4.3.0"/>
    <PackageReference Include="Useful.Utilities" Version="1.0.5"/>
  </ItemGroup>
</Project>

The problem is that there is no Intellisense.

When I want to do a using

SqlCommand

But it's working on Visual Studio Community Version 16.0.0 RC2

Add a using with Intellisense working

SqlCommand

The problem occur not only with System.Data.SqlClient but with all nuget package I added.

What should I do to have a working Intellisense on Visual Studio Code ?

3

2 Answers 2

0

You can reset settings and extensions, and if that does not not help, do a clean VS install

2
  • 6
    I have reset my settings after that the intellisense worked but when I restart my computer the intellisense was no longer working... I figured out why, this is because I opened the Parent Folder of the folder my project and not the folder of the project. It's silly but now it's working well.
    – xqlimax
    Mar 13, 2019 at 19:00
  • I did the same thing working with VSCode Dev Containers. I just opened the project folder in VSCode instead of the parent Dev container folder and everything is fine now. Thank you. This really should be the answer to this question.
    – Tolga
    Jun 13, 2020 at 13:23
0

To elevate @xqlimax's comment to an answer, since I had this same problem and the comment solved it:

If the project that contains package references is in a subfolder of the folder currently open in VSCode, Intellisense doesn't seem to pick up package references from that project.

Instead, open the folder that contains the project directly.

When working with Dev Containers, if you have your Dev Container config in a parent folder but want to work with a project in a subfolder, you can use this trick:

Once connected [to the container] use File > Open... / Open Folder... to select one of the [subfolders]. In a moment, VS Code will open the folder inside the same container. In the future, you can use the Remote Explorer in the Activity Bar to open this sub-folder in the container directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.