Search code examples
nugetvisual-studio-2022

VS2022 Not creating Nuget package when requested


When I want to create or update a Nuget package for my project I normally create it by clicking on "Build" -> "Pack projectName" however it has stopped working overnight. There are quite a few "fixes" claimed on StackOverflow however none have worked for me. I have removed any other projects from the solution.

Here is my project configuration file:

  <Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <AssemblyVersion>1.0.5.0</AssemblyVersion>
    <Copyright>Copyright 2023</Copyright>
    <Description>A internal utilities</Description>
    <FileVersion>2023.10.4.1</FileVersion>
    <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
    <ImplicitUsings>enable</ImplicitUsings>
    <IsPackable>true</IsPackable>
    <LangVersion>10.0</LangVersion>
    <Nullable>enable</Nullable>
    <PackageVersion>2.0.5</PackageVersion>
    <PackageOutputPath>\bin\Packages</PackageOutputPath>
    <RootNamespace>AC</RootNamespace>
    <TargetFrameworks>net6.0;net48</TargetFrameworks>
    <Title>AC utilities</Title>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="System.Security.Cryptography.Cng" Version="5.0.0" />
    <PackageReference Include="System.Text.Json" Version="7.0.3" />
  </ItemGroup>
</Project>

I assume that both the debug and release builds must be completed prior to requesting the "Pack".

I have also tried the dotnet pack command and get the following result:

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.7.3
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************

T:\MyProjects\AC>dotnet pack
MSBuild version 17.7.1+971bf70db for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  AC -> T:\MyProjects\AC\AC\bin\Debug\net6.0\AC.dll
  AC -> T:\MyProjects\AC\AC\bin\Debug\net48\AC.dll

The result of the dotnet command would seem to indicate that VS2022 has completely lost the plot because I'm beginning to believe I have :-)


Solution

  • Changed to :

    <PackageOutputPath>bin\Packages</PackageOutputPath>