NuGet\Install-Package in only downloading package not creating package.config for projects inside the solution

24 views Asked by At

I used this NuGet\Install-Package Microsoft.CodeAnalysis.NetAnalyzers -Version 8.0.0 command to install the nuget package for the solution it is only creating packages folder i am not able to see the package.config in the projects folder is there any way that i can do this from package manger cli.

1

There are 1 answers

0
jakub podhaisky On

In NuGet 4.0+ the package.config is not common for packages anymore instead the packages have reference in your project file please check your project.csproj than in your .csproj file there should be <ItemGroup> where you should see your <PackageReference> it should look something like this:

<ItemGroup>
    <PackageReference Include="jQuery" Version="3.7.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.15" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Localization" Version="2.2.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.7" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.7" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.7">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="6.1.0" />
    <PackageReference Include="Microsoft.VisualStudio.SlowCheetah" Version="4.0.50">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="MySql.EntityFrameworkCore" Version="7.0.5" />
    <PackageReference Include="MySqlConnector" Version="2.2.6" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
    <PackageReference Include="Select2.js" Version="4.0.13" />
    <PackageReference Include="System.Drawing.Common" Version="7.0.0" />
    <PackageReference Include="toastr" Version="2.1.1" />
    <PackageReference Include="ZXing.Net" Version="0.16.9" />
  </ItemGroup>

there is also a posibility that your project includes a whole folder for some reference like for my select-2 and toastr:

<ItemGroup>
    <Folder Include="wwwroot\lib\select-2\" />
    <Folder Include="wwwroot\lib\Resources\Fonts\" />
    <Folder Include="wwwroot\lib\Resources\Images\" />
    <Folder Include="wwwroot\lib\toastr\" />
    <Folder Include="wwwroot\Resources\imgs\" />
  </ItemGroup>

also you should see your packages in your solution explorer under dependencies => packages

I believe if your package is installed correctly there should be a line like this in your .csproj

<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" />

You can also add your PackageReferences yourself if for some reason is your nuget manager not creating them