nuget 相关问题

NuGet是一个免费的,开源的开发人员,专门用于.NET平台的包管理系统。

nuget 无法识别已安装的软件包

我在 Git 上有一个使用 NuGet 库的 C# 项目。一切工作正常,但是当我打开一台新机器并在 Visual Studio 中打开解决方案时,由于损坏而无法编译

回答 7 投票 0

Azure devops 找不到自定义 nuget 包

我有一个自定义库,它被打包并作为 nuget 包发布到此服务器: https://pkgs.dev.azure.com/my-project-feed/_packaging/my-project-feed/nuget/v3/index.json 据我所知...

回答 1 投票 0

如何使用 dotnet cli 列出可用的软件包版本?

使用 dotnet cli 如何列出特定包的可用包版本?

回答 3 投票 0

带有 nuspec 的 Nuget 包包含内部的所有解决方案

我想使用 nuget pack 命令(对于遗留的非 sdk 项目),同时能够更改包内的描述和其他元数据。在这个问题的评论中,我被告知...

回答 1 投票 0

如何在离线计算机上安装 PowerShell 的 Nuget 提供程序?

我正在尝试在运行 Windows Server 2016 的离线工作计算机上安装 NuGet。文件可以通过 NAS 上传到该计算机。所有在线机器都具有受限的管理权限,而离线机器

回答 2 投票 0

Cake.Build 不会生成 nuget 和非 sdk 项目的描述

我有非常简单的 nuget 包,使用 cake.build 创建逻辑: var nugetSettings = 新 NuGetPackSettings { 输出目录 = "%some_path%", ...

回答 1 投票 0

如果 nuget-package 需要已弃用的依赖项该怎么办?

我需要摆脱已弃用的 nuget 软件包,用新版本或替代品替换它们。 但是,如果另一个未弃用的软件包依赖于已弃用的软件包,我该怎么办? 例如...

回答 1 投票 0

PowerShell安装NuGet,说无法访问互联网,但实际上可以

我按照在代理后面使用 PowerShell 中提到的步骤来配置我的代理服务器。 netsh winhttp 设置代理“[IP]:[端口]” $Wcl = 新对象 System.Net.WebClient $Creds = 获取凭证...

回答 5 投票 0

如何从 Nuget 更新锁定软件包版本

我正在使用 Aspose 进行一些文档管理,我们的许可证只提供一年的更新,现已过期。因此,当我们以典型的方式更新软件包并获取最新版本的

回答 4 投票 0

添加 Nuget 包还会添加对其他项目的引用吗?

.Net 4.8 C# Api 项目,由 1 个主项目和 5 个附加类库项目组成。 我需要向类库项目之一添加功能,以便能够访问存储在...中的值

回答 1 投票 0

包“dotnet-sonarscanner 5.0.4”具有项目“Project.xyz”不支持的包类型“DotnetTool”

一个解决方案中共有 6 个项目。 dotnet-sonarscanner 软件包仅适用于其中 4 个。 我收到以下错误,表明该包不受项目“project.x...

回答 3 投票 0

.Net 标准库

我正在开发类库,想要使用管道在Azure DevOps中发布NuGet包。 大多数现有的内部应用程序都支持 .net 4.8 框架,但我看到了使用 .NET 的潜力...

回答 1 投票 0

尝试 dotnet 恢复时出现 NuGet 错误 NU1301

当尝试执行“dotnet Restore”(在 docker build 命令内)时,出现以下错误: > [构建 4/5] 运行 dotnet 恢复: 0.994 确定要恢复的项目... 8.298 /应用程序/

回答 1 投票 0

将 NuGet-package 推送到 GitLab 包注册表时出错 -> NuGet.Temporary.Package

我在将 NuGet 包推送到我们公司的 GitLab 包注册表时遇到问题。 在我的 NuGet-Package 中,我打包了一些二进制文件。这是 Nuspec 文件: 我在将 NuGet 包推送到我们公司的 GitLab 包注册表时遇到问题。 在我的 NuGet-Package 中,我打包了一些二进制文件。这是 Nuspec 文件: <?xml version="1.0" encoding="utf-8"?> <package> <metadata> <id>test</id> <version></version> <authors>Company</authors> <description>Demo Project</description> </metadata> <files> <file src="../../__out/test/**" target="" /> </files> </package> 我构建了在 CI 中看起来不错的 nuget 包(我已经下载并检查了 nuget 文件) 构建完成后,我将包含此 CI 作业的 NuGet-Package 推送到注册表中。 Gitlab CI: deploy: stage: deployNuGet image: mcr.microsoft.com/dotnet/sdk:5.0-buster-slim script: - dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text - dotnet nuget push __out/package/test.0.0.1.nupkg" --source gitlab 这会导致以下 CI 日志: $ dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text Package source with Name: gitlab added successfully. warn : No API Key was provided and no API Key could be found for 'https://XXXX/api/v4/projects/XXXX/packages/nuget'. To save an API Key for a source use the 'setApiKey' command. Pushing test.0.0.1.nupkg to 'https://XXXXXX/api/v4/projects/XXXXX/packages/nuget'... PUT https://XXXXX/api/v4/projects/XXXXXX/packages/nuget/ Created https://XXXXX/api/v4/projects/XXXXXX/packages/nuget/ 780ms Your package was pushed. 这对于退出一段时间来说效果很好,但现在我得到了不同的行为。 代替 test 包的是 NuGet.Temporary.Package。 当我移到错误标志上时,它会显示以下消息: Invalide Package: failed metadate extraction 有人知道如何解决这个问题吗? 这是自我管理的 AWS 实例上的 gitlab (14.0.x) 错误。 还有一个 MR 可以解决这个问题。 这是问题的解决方案https://gitlab.com/gitlab-org/gitlab/-/issues/335488#note_623985000 这有点愚蠢,但如果有人像我一样复制粘贴命令,请确保您上传的是正确的文件(.nupkg文件)。我正在上传 .csproj 文件,因为我复制并粘贴了 dotnet pack 中的路径。如果您上传 .csproj 文件,Gitlab 不会发出警告或任何内容。 在 GitLab 16.9 版本(撰写本文时的最新版本)中,如果您在 .CSPROJ 文件中指定 <PackageProjectUrl> 或 <PackageIconUrl>,则会在我们的自托管实例上发生这种情况。 “解决方案”/解决方法是删除/注释掉这些属性。

回答 3 投票 0

在 dotnet 项目中发现易受攻击的 nuget 包时,使 GitHub Actions CI 构建失败时出错

我正在检查当解决方案中的项目中发现易受攻击的 nuget 包时使 GitHub Actions CI 构建失败的方法。这是回购协议 最初,我有以下简单的命令...

回答 1 投票 0

如何将原生NuGet包安装到.NET6项目

我正在尝试将我们的 WinForms 项目从 .NET Framework 迁移到 .NET6。由于该解决方案是为 SharpDevelop 设计的,因此我们拥有从 dll 链接的所有依赖项。 我想利用Nu的优势...

回答 1 投票 0

从源代码管理中隐藏 nuget.config 中的明文密码

我有一个 nuget.config 文件,如下所示: &l...

回答 2 投票 0

Microsoft.PackageDependencyResolution.targets(266,5):错误NETSDK1005:资产文件“obj\project.assets.json”没有“net8.0”的目标

我有一个简单的 C# 项目,其中包含以下 .csproj 文件: net8.0 我有一个简单的 C# 项目,包含以下 .csproj 文件: <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net8.0</TargetFramework> <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks> <UseMaui>true</UseMaui> <SingleProject>true</SingleProject> <ImplicitUsings>enable</ImplicitUsings> </PropertyGroup> <PropertyGroup> <EnableDefaultCompileItems>true</EnableDefaultCompileItems> </PropertyGroup> <ItemGroup> <PackageReference Include="CrcDotNET" Version="1.0.3" /> <PackageReference Include="System.IO.Ports" Version="8.0.0" /> <PackageReference Include="System.Threading.Tasks" Version="4.3.0" /> </ItemGroup> </Project> 当我尝试使用“dotnet build Foo.csproj”在 localdev 上构建它时,一切都可以正常工作。但是当我在 Azure 上使用相同的命令时,我收到以下神秘错误: 2024-02-22T12:23:29.8030466Z ##[section]Starting: Build and Pack 'Laeerdal.Usb.csproj' 2024-02-22T12:23:29.8150494Z ============================================================================== 2024-02-22T12:23:29.8151277Z Task : .NET Core 2024-02-22T12:23:29.8151536Z Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command 2024-02-22T12:23:29.8151870Z Version : 2.235.0 2024-02-22T12:23:29.8152112Z Author : Microsoft Corporation 2024-02-22T12:23:29.8152370Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli 2024-02-22T12:23:29.8152667Z ============================================================================== 2024-02-22T12:23:30.2857118Z [command]C:\Windows\system32\chcp.com 65001 2024-02-22T12:23:30.2964423Z Active code page: 65001 2024-02-22T12:23:30.3088676Z Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version. 2024-02-22T12:23:30.3142054Z [command]"C:\Program Files\dotnet\dotnet.exe" build D:\a\1\s\Foo\Foo.csproj "-dl:CentralLogger,\"D:\a\_tasks\DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b\2.235.0\dotnet-build-helpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll\"*ForwardingLogger,\"D:\a\_tasks\DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b\2.235.0\dotnet-build-helpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll\"" /restore /p:PackageOutputPath=D:\a\1\a /p:JavaSdkDirectory=C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.402-6\x64/ /p:VersionMajor=1 /p:VersionMinor=30 /p:VersionPatch=2 /p:VersionRevision=50224 /p:VersionSuffix= 2024-02-22T12:23:30.4882178Z MSBuild version 17.9.4+90725d08d for .NET 2024-02-22T12:23:31.3250928Z Determining projects to restore... 2024-02-22T12:23:31.5489970Z ##[warning]C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): Warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file. 2024-02-22T12:23:31.5529575Z C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file. [D:\a\1\s\Foo\Foo.csproj::TargetFramework=net8.0] 2024-02-22T12:23:31.6426560Z ##[warning]C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): Warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file. 2024-02-22T12:23:31.6431641Z C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file. [D:\a\1\s\Foo\Foo.csproj::TargetFramework=net8.0-windows10.0.19041.0] 2024-02-22T12:23:32.5074255Z Restored D:\a\1\s\Foo\Foo.csproj (in 702 ms). 2024-02-22T12:23:37.4168585Z ##[warning]C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): Warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file. 2024-02-22T12:23:37.4173672Z C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file. [D:\a\1\s\Foo\Foo.csproj::TargetFramework=net8.0] 2024-02-22T12:23:37.6003354Z ##[error]C:\Program Files\dotnet\sdk\8.0.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): Error NETSDK1005: Assets file 'D:\a\1\s\Foo\obj\project.assets.json' doesn't have a target for 'net8.0'. Ensure that restore has run and that you have included 'net8.0' in the TargetFrameworks for your project. 2024-02-22T12:23:37.6025309Z C:\Program Files\dotnet\sdk\8.0.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1005: Assets file 'D:\a\1\s\Foo\obj\project.assets.json' doesn't have a target for 'net8.0'. Ensure that restore has run and that you have included 'net8.0' in the TargetFrameworks for your project. [D:\a\1\s\Foo\Foo.csproj::TargetFramework=net8.0] 2024-02-22T12:23:37.9060631Z 2024-02-22T12:23:37.9092458Z Build FAILED. 2024-02-22T12:23:37.9172096Z 2024-02-22T12:23:37.9242343Z C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file. [D:\a\1\s\Foo\Foo.csproj::TargetFramework=net8.0] 2024-02-22T12:23:37.9327192Z C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file. [D:\a\1\s\Foo\Foo.csproj::TargetFramework=net8.0-windows10.0.19041.0] 2024-02-22T12:23:37.9343030Z C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.6\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file. [D:\a\1\s\Foo\Foo.csproj::TargetFramework=net8.0] 2024-02-22T12:23:37.9348329Z C:\Program Files\dotnet\sdk\8.0.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1005: Assets file 'D:\a\1\s\Foo\obj\project.assets.json' doesn't have a target for 'net8.0'. Ensure that restore has run and that you have included 'net8.0' in the TargetFrameworks for your project. [D:\a\1\s\Foo\Foo.csproj::TargetFramework=net8.0] 2024-02-22T12:23:37.9349813Z 3 Warning(s) 2024-02-22T12:23:37.9350763Z 1 Error(s) 2024-02-22T12:23:37.9352937Z 2024-02-22T12:23:37.9385231Z Time Elapsed 00:00:07.20 2024-02-22T12:23:39.2936283Z ##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1 2024-02-22T12:23:39.2939954Z ##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build 2024-02-22T12:23:39.2961848Z Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting 2024-02-22T12:23:39.2963921Z ##[error]Dotnet command failed with non-zero exit code on the following projects : [ 'D:\\a\\1\\s\\Foo\\Foo.csproj' ] 2024-02-22T12:23:39.3057978Z ##[section]Finishing: Build and Pack 'Laeerdal.Usb.csproj' (并回答我自己的问题...)错误是我正在使用: <TargetFramework>net8.0</TargetFramework> 虽然我应该使用: <TargetFrameworks>net8.0</TargetFrameworks> 构建在 localdev 上运行的原因是我的 localdev 在 MacOS 上运行,而 Azure 中的管道在 Windows 上运行,就此而言,构建也将针对 net8.0 之上的 net8.0-windows10.0.19041.0 依次进行堵塞的 msbuild 导致上面提到的神秘错误。 希望这可以帮助某人避免因为问题而用头撞墙的两天。

回答 1 投票 0

无法找到包 Microsoft.VisualStudio.Azure.Containers.Tools.Targets

我正在尝试获取 swagger 库,但会发生以下错误,即使我创建的新项目带有默认错误: dotnet 添加包 Swashbuckle.AspNetCore --版本 2.0.0 写入 C:\

回答 1 投票 0

Blazor 组件 - 无法获取动态导入的模块 - telerikReportViewer

我在前端 .razor 文件中调用了组件 。 构建应用程序后在前端打开组件时出现此错误: 获取 https://localhost:44...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.