nuget-package 相关问题

NuGet是一个Visual Studio扩展,可以在Visual Studio中轻松安装和更新开源库和工具。

使用 Github Actions 恢复 Azure DevOps 中托管的私有 Nuget 包失败

我有一个 .NET 项目,它使用托管在 Azure DevOps 中的私有 Nuget 包。我有一个 Github Actions 工作流程,它使用个人访问令牌注册私人提要,并恢复

回答 1 投票 0

从 https://github.com/Azure-Samples/active-directory-b2c-dotnet-webapp-and-webapi 下载的代码无法正确构建。 Nuget pckgs 错误

我从 https://github.com/Azure-Samples/active-directory-b2c-dotnet-webapp-and-webapi 下载了解决方案代码。 但是当我尝试重建它时,我收到 Owin NuGet 包的错误。 ['Owin.1.0.1'...

回答 1 投票 0

不同版本的Nuget包版本解析

我使用的 Nuget 包本身引用了 System.Reactive 的早期版本(特别是 4.3.2)。我不是维护者,无法更改它,但仍然想使用该包。

回答 2 投票 0

如何将 11mb .zip 文件推送到 devops Repo

我正在开发一个 git 存储库,其中有 11mb .zip 文件,其中有 4 个文件夹和 rar 文件包。现在我对 XML 文件进行了一些更改,该文件是 Repo 中的文件夹之一。 同时

回答 2 投票 0

错误 NU1101:缺少 WebEid.Security 包

我正在尝试 WebEid dotnet 示例,您可以在这里找到:https://github.com/web-eid/web-eid-asp-dotnet-example 我完成了快速启动步骤,但是当我尝试“dotnet build”步骤时,我...

回答 1 投票 0

如何在 ADO 中仅使用 .json 文件创建 NuGet 包,没有 csproj 或二进制文件

由于工作场所中 ADO 的安全问题,我无法在项目构建期间恢复 GIT 子模块。我们需要的一个依赖项是一组通用且特定于堆栈的配置文件...

回答 1 投票 0

C# .Net 如何将应用程序重定向到已安装的 .Net Framework(从控制台,无需 Visual Studio)

有人给我发送了一个解决方案,其中包含一些 C# 项目文件。我只使用 dotnet 的命令行界面,并且由于计算机内存不足而没有安装 Visual Studio。 ...

回答 1 投票 0

在开发模式下使用自定义 MSBuild 任务时的文件锁定问题

我正在按照 Microsoft 示例中概述的指导开发自定义 MSBuild 任务。开发工作流程不好,因为每当我更改任务并且想要测试它时,要做...

回答 1 投票 0

无法从另一个gitlab项目获取nuget包(错误NU1301)

我在本地安装了Gitlab。我有两个项目:一个工具包(项目 1)和第二个项目(项目 2),它使用第一个项目中的 nuget 包。 nuget包存放在Gitlab的

回答 2 投票 0

在 Blazor 服务器中用 DLL 替换 nuget 包

我有 Blazor 服务器应用程序,它使用一些 nuget 包并且工作正常。现在我想引用 DLL /Assemblies 而不是 nuget packges,因为我们的构建服务器无法处理 nuget 包,而且我...

回答 1 投票 0

无法在linux中为nuget包创建目标路径,但它可以在Windows中工作

目前我正在尝试借助 nuspec 文件在 Linux 中创建 nuget 包。以下是我的 nuspec 文件的内容。 目前我正在尝试借助 nuspec 文件在 Linux 中创建 nuget 包。以下是我的 nuspec 文件的内容。 <?xml version="1.0"?> <package > <metadata> <id>myProject.Emulation.SPI.Virtual</id> <version>$version$</version> <title>myProject Emulation SPI Virtual</title> <authors>myProject AG</authors> <owners>myProject AG</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Provides all Emulation .</description> <tags>Emulation SPI Virtual</tags> <dependencies> <group targetFramework=".NETStandard2.0" > <dependency id="myProject.Energy.Emulation.Loader" version="2.0.1" /> <dependency id="Microsoft.ApplicationInsights" version="2.21.0" /> <dependency id="Microsoft.ApplicationInsights.TraceListener" version="2.21.0" /> <dependency id="System.Configuration.ConfigurationManager" version="7.0.0" /> <dependency id="System.Diagnostics.DiagnosticSource" version="7.0.2" /> <dependency id="System.Drawing.Common" version="7.0.0" /> <dependency id="Microsoft.Win32.SystemEvents" version="7.0.0" /> </group> </dependencies> </metadata> <files> <file src="../../_Out/Release/myProject.Energy.Emulation.dll" target="lib/netstandard2.0"/> <file src="../../_Out/Release/myProject.Energy.Emulation.Data.dll" target="lib/netstandard2.0"/> </files> </package> 通过使用此命令nuget pack <myproject>.nuspec -version 4.4.4我可以在linux中创建一个nuget文件,但是当我在linux中解压nuget包时,我看不到lib文件夹和其中的dll。 目前我在 Ubuntu Linux 机器上使用 NuGet Version: 2.8.7.0,但同样的事情也在 Windows 中工作,我可以在其中看到 lib 文件夹及其内容。在窗口中NuGet Version: 6.1.0.106 请帮我解决这个问题 下面是在linux中解压后的nuget包的示例 nuget pack .nuspec -version 4.4.4 -NoDefaultExcludes 如果我们在 src 属性中给出相对路径,则此命令有效

回答 1 投票 0

配置外部nuget源时恢复项目失败

我在我的机器上的 nuget.config nuget 源中配置了一些。 其中之一(externalSource)查看外部受保护源(以下所有内容均由VS生成): 我的机器上的 nuget.config nuget 源配置很少。 其中之一(externalSource)查看外部受保护源(以下所有内容均由 VS 生成): <?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> <add key="externalSource" value="https://.external_source./nuget/v3/index.json" /> <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" /> </packageSources> </configuration> 我可以在浏览器中从我的机器上的所有源检索json配置,我可以在浏览器中输入正确的凭据(即使用它没有任何问题)。另外,我可以在 VS 中的 Nuget Manager UI 中轻松使用这个 nuget 源代码。 我正在使用的机器也可以访问不同的 nuget 源,但该源未在任何地方配置(在 VS 或任何 nuget.config 中)。 现在,我创建一个简单的控制台应用程序: PS C:\..> dotnet new console --no-restore The template "Console App" was created successfully 注意:我故意跳过恢复以将问题区域限制为仅restore逻辑,如果没有此选项,new console命令将失败,即使项目本身将被创建。 现在我想恢复创建的应用程序: PS C:\..> dotnet restore Determining projects to restore... C:\Program Files\dotnet\sdk\8.0.100\NuGet.targets(156,5): error : Unable to load the service index for source "https://.external_source./nuget/v3/index.json". [C:\..\test.csproj] C:\Program Files\dotnet\sdk\8.0.100\NuGet.targets(156,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\..\test.csproj] 当我启用详细的日志记录详细程度时,我发现此步骤中发生了失败: 1>Target "Restore" in file "C:\Program Files\dotnet\sdk\8.0.100\NuGet.targets" from project "C:\..\test.csproj" (entry point): Task "RemoveDuplicates" Done executing task "RemoveDuplicates". Using "RestoreTask" task from assembly "C:\Program Files\dotnet\sdk\8.0.100\NuGet.Build.Tasks.dll". Task "RestoreTask" (in) RestoreGraphItems Count '4' (in) RestoreDisableParallel 'False' (in) RestoreNoCache 'False' (in) RestoreIgnoreFailedSources 'False' (in) RestoreRecursive 'True' (in) RestoreForce 'False' (in) HideWarningsAndErrors 'False' (in) RestoreForceEvaluate 'False' (in) RestorePackagesConfig 'False' .. CACHE https://api.nuget.org/v3/vulnerabilities/vulnerability.update.json 1>C:\Program Files\dotnet\sdk\8.0.100\NuGet.targets(156,5): error : Unable to load the service index for source https://.external_source./nuget/v3/index.json. [C:\..\test.csproj] C:\Program Files\dotnet\sdk\8.0.100\NuGet.targets(156,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\..\test.csproj] Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.StackTrace, Version=8.0.0.0, Culture=neutral, PublicKeyToken=.. (location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.0\System.Diagnostics.StackTrace.dll, MVID: .., AppDomain: [Default]) NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://.external_source./nuget/v3/index.json. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized). .. 我该如何修复它? 配置如下: 在 nuget.config 中: <packageSourceCredentials> <externalSource> <add key="Username" value="name" /> <add key="ClearTextPassword" value=".." /> </externalSource> </packageSourceCredentials> 或 dotnet restore 命令的选项: --interactive 或 --ignore-failed-sources 没有帮助。我可以使用选项 --source=nuget.org 修复它,但我必须配置 externalSource,因为在其他一些情况下应该从这个源进行恢复 更新:如果我通过以下方式检索nugets,错误就会消失:nuget search -take 10 -Source externalSource(当我运行它时,我没有看到任何提示或弹出窗口)在错误发生后,但只持续大约30分钟,然后它开始失败并显示401又出错了 UPDATE2 可重现问题的机器是 Windows 11 Enterprise,不确定这是否重要,但我在 Windows 10 上没有看到任何问题 UPDATE3 看起来解决问题的另一种方法是调用msbuild -t:Restore。这听起来像是 dotnet 二进制问题吗? 正确的答案确实是下载并设置artifacts凭证提供程序 在 Azure DevOps 工件上设置源时,系统会向您提供从多个源连接到源的说明。如果我们选择 dotnet CLI 的说明,则会显示以下内容:

回答 1 投票 0

Blazor Web 应用程序(.net 8 服务器) - Razor 组件库 RCL 作为 NuGet(本地源)w MainLayout 样式共享

找到答案后更新,供有问题的人将来参考 我想做什么: 在我的 web 应用程序上使用 MainLayout 来利用 RCL 的 razor 组件传入导航菜单并使用 ...

回答 1 投票 0

nuget add 在 msbuild exec 命令中不起作用

我正在尝试在 VS2022 中自动化流程 Build -> Pack -> Add for nuget package。我已经创建了 SDK 类型项目并使用默认设置来创建 nuget 包。执行 Pack Comm 后...

回答 1 投票 0

需要一些帮助 - Blazor Web 应用程序(.net 8 服务器) - Razor 组件库 RCL 作为 NuGet(本地源)w MainLayout 样式共享

我正在尝试做的事情: 在我的 web 应用程序上使用 MainLayout 来利用 RCL 的 razor 组件传入导航菜单并使用共享库样式等。 我有一个 RCL,其中包含 2 个剃须刀组件...

回答 1 投票 0

从 Microsoft.Azure.Management.Fluent 迁移到 Azure.ResourceManager 时如何处理 IAzure Interface?

我正在迁移源代码以使用 Azure.ResourceManager 包而不是 Microsoft.Azure.Management.Fluent (已弃用)。 我的代码使用 IAzure 接口,如下所述: /// 我正在迁移源代码以使用 Azure.ResourceManager 包,而不是 Microsoft.Azure.Management.Fluent(已弃用)。 我的代码使用 IAzure 接口,如下所述: /// <summary> /// The azure context. /// </summary> private readonly IAzure azureContext; this.azureContext = this.GetAzureForSubAsync().ConfigureAwait(false).GetAwaiter().GetResult(); // method declaration here for GetAzureForSubAsync private async Task<IAzure> GetAzureForSubAsync() { // <some logic> return Azure.Configure() .WithLogLevel(HttpLoggingDelegatingHandler.Level.BodyAndHeaders) .Authenticate(new AzureCredentials(tokenCredentials, tokenCredentials, tenantId, AzureEnvironment.AzureGlobalCloud)) .WithSubscription(this.subscriptionId); } 我不确定哪个接口会在新包中为我提供等效的逻辑,即。 Azure.ResourceManager 在构建管道时,我收到此错误: ##[error]src\Test\LoadTest\ARMLib\ARMExecutor.cs(16,21): Error CS0234: The type or namespace name 'Rest' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) ##[error]src\Test\LoadTest\ARMLib\ARMExecutor.cs(170,28): Error CS0246: The type or namespace name 'IAzure' could not be found (are you missing a using directive or an assembly reference?) ##[error]src\Test\LoadTest\ARMLib\ARMExecutor.cs(26,26): Error CS0246: The type or namespace name 'IAzure' could not be found (are you missing a using directive or an assembly reference?) 我已经阅读了文档,但我认为我没有得到它。 https://learn.microsoft.com/en-us/dotnet/api/azure.resourcemanager?view=azure-dotnet 您可以使用ArmClient 类 (Azure.ResourceManager) - Azure for .NET 开发人员 | Microsoft Learn,它是 Azure.ResourceManager 类中 IAzure 的替代品:- 示例代码这里:- using System; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.Compute; using Azure.ResourceManager.Resources; ArmClient client = new ArmClient(new DefaultAzureCredential()); string resourceGroupName = "siliconrg"; SubscriptionResource subscription = await client.GetDefaultSubscriptionAsync(); ResourceGroupCollection resourceGroups = subscription.GetResourceGroups(); ResourceGroupResource resourceGroup = await resourceGroups.GetAsync(resourceGroupName); await foreach (VirtualMachineResource virtualMachine in resourceGroup.GetVirtualMachines()) { //previously we would have to take the resourceGroupName and the vmName from the vm object //and pass those into the powerOff method as well as we would need to execute that on a separate compute client await virtualMachine.PowerOffAsync(WaitUntil.Completed); } 输出:- DevOps YAML 管道:- trigger: - master pool: vmImage: 'windows-latest' variables: solution: '**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' steps: - task: NuGetToolInstaller@1 - task: NuGetCommand@2 inputs: restoreSolution: '$(solution)' - task: VSBuild@1 inputs: solution: '$(solution)' msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"' platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' 输出:- 有人可以帮忙吗? 我也面临同样的问题。 上述使用 ArmClient 类的解决方案没有任何 Iazure 接口,

回答 2 投票 0

错误:NU1100:无法解析“net5.0”的“MicrosoftOfficeCore (>= 15.0.0)”

在 Visual Studio Code 的终端中,当我尝试运行时: dotnet 添加包 MicrosoftOfficeCore --版本 15.0.0 我在 Visual Studio Code 终端上收到以下错误: 错误:NU1100:无法恢复...

回答 2 投票 0

c# 中类库项目的源生成器

是否可以使用C#中的Source Generator生成代码到类库项目中?我希望将这个自动生成的代码打包到 Nuget 包中。 当我尝试构建一个项目时...

回答 1 投票 0

Visual Studio nuget 未安装包

当我尝试向新项目添加依赖项时,它不起作用。我收到以下错误: PM> 安装包 Microsoft.EntityFrameworkCore.SqlServer 正在恢复 E:\CProjects\

回答 1 投票 0

如何修复 Visual Studio 2022 中包源映射关闭的问题?

当我单击 NuGet 包管理器中的任何包时,我看到消息“包源映射在 Visual Studio 2022 17.8.0 中已关闭”。 当我单击“配置”链接时,它会打开以下窗口...

回答 1 投票 0

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