VS2022 在请求时不创建 Nuget 包

问题描述 投票:0回答:1

当我想为我的项目创建或更新 Nuget 包时,我通常通过单击“构建”->“打包项目名称”来创建它,但它已在一夜之间停止工作。 StackOverflow 上声称有不少“修复”,但没有一个对我有用。我已从解决方案中删除了任何其他项目。

这是我的项目配置文件:

  <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>

我假设调试和发布版本都必须在请求“Pack”之前完成。

我还尝试了 dotnet pack 命令并得到以下结果:

**********************************************************************
** 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

dotnet命令的结果似乎表明VS2022已经完全失去了情节,因为我开始相信我已经:-)

nuget visual-studio-2022
1个回答
0
投票

更改为:

<PackageOutputPath>bin\Packages</PackageOutputPath>
© www.soinside.com 2019 - 2024. All rights reserved.