我正在寻找 nuget 来改进开发过程中对依赖项(内部和第三方)的自动处理。
只要你通过 CI Build Server 开发,一切都好:
但是,我想知道是否可以作为单个开发人员在本地工作,而不必等待 CI Build Server 生成新包?
Nuget 具有包还原功能,它将在构建时自动下载所有依赖项。您还可以列出包还原应查找包的存储库顺序。
如果工作流程可以变成:
这是否可以使用 Visual Studio、MSBuild、CI 构建服务器和 nuget?我对在本地开发的同时制作本地包特别感兴趣。
请注意,我有本机项目,尽管除了生成 nuget 包后期构建之外,这将是一个我希望应该适用于 …
continuous-integration automation nuget nuget-package-restore
我在解决方案中遇到构建速度非常慢的问题,该解决方案有 12 个项目,其中 7 个项目启用了 NuGet Package Restore。诊断输出通常显示以下内容:
[...]
9 ms ResolveProjectReferences 1 calls
18 ms _CleanGetCurrentAndPriorFileWrites 1 calls
32 ms CoreClean 1 calls
56 ms ResolveAssemblyReferences 1 calls
77 ms _CopyFilesMarkedCopyLocal 1 calls
400 ms CoreCompile 1 calls
9082 ms RestorePackages 1 calls
Run Code Online (Sandbox Code Playgroud)
这是典型的;RestorePackages 通常每个项目需要 9-10 秒,对于 7 个项目,这会导致我的构建时间增加 70 秒。我构建相同解决方案的同事都没有这个问题。我已禁用所有扩展,并且 Visual Studio (2012) 是最新的。
我已在 CodePlex 上提交了一个问题,但我还想询问这个知识渊博的社区是否有快速修复方案,并寻求帮助来解决此问题。
编辑:我完全删除了 NuGet——RestorePackages 目标仍在执行,并且仍然需要 10 秒。我需要在 csproj 文件中手动设置RestorePackages = false才能消除此问题。
编辑2:如果我注释掉 NuGet.targets 中 RestorePackages 任务中的内容,问题也会消失。像这样:
<Target …Run Code Online (Sandbox Code Playgroud) 目前,我正在Visual Studio 2017中开发.net core项目。我还需要在 VSTS 中设置 CI(持续集成)。
这是我的构建定义中的 nuget 恢复步骤
但我的构建失败了,因为它无法恢复任何包。这是它的日志。它说“此解决方案中的项目均未指定任何包”。我知道在 VS2017 中他们改变了 nuget 包的处理方式。有人对此有想法或经验吗?
2017-03-22T20:25:11.9517911Z MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
2017-03-22T20:25:11.9674167Z Nothing to do. None of the projects in this solution specify any packages for NuGet to restore.
2017-03-22T20:25:11.9830425Z ##[section]Finishing: NuGet restore **/*.sln
Run Code Online (Sandbox Code Playgroud)
我不想使用,dotnet restore因为微软这么说
.NET Core 的 dotnet Restore 命令当前不支持加密凭据。要将 VSTS NuGet 源与 dotnet 还原结合使用,您需要以纯文本形式指定个人访问令牌。
所以我不想存储我的个人访问令牌。 https://www.visualstudio.com/en-us/docs/package/nuget/auth#net-core
c# nuget-package-restore .net-core azure-devops visual-studio-2017
我们在本地托管 TFS 2017 Update 2,并使用本地构建代理。NuGet.exe 的最新版本目前是 4.3.0,但我们的构建代理始终默认使用 v4.0.0。如何让我们的构建代理使用最新版本的 NuGet.exe?
我们需要更新,因为NuGet restore在使用 v4.0.0 时失败,但可以使用 v4.3.0,因为我们正在处理新的 .Net Standard 2.0 包。在我们的构建服务器上,我能够将NuGet.exe update -self在C:\Builds\_work\_tool\NuGet\4.0.0\x64\nuget.exe4.0.0 中找到的 NuGet.exe 更新到 4.3.0,但该C:\Builds\_work\_tool目录会定期被删除和重新创建,因此这不是一个持久的解决方法。
如何让我们的构建代理始终使用最新版本的 NuGet.exe,或者至少是 v4.3.0?
tfs nuget nuget-package-restore azure-devops azure-devops-self-hosted-agent
目前我有一个要求,我们有单独的合同和实施程序集。创建 nuget 包并尝试使用 nuget 包后,它会失败,因为包管理器无法找到依赖(合同)程序集。
这似乎是 .net core 中的一个开放问题。
https://github.com/dotnet/cli/issues/3959
无法理解为什么这么简单的事情在.net core 中不起作用。正在寻找此问题的解决方法。
我知道关于相同签名的其他帖子。经过他们之后,我仍然无法解决我的问题。
这个构建定义工作正常,直到 lastes pull request。我在 Nuget 恢复期间遇到了下面的错误消息
2018-06-20T00:37:27.6438127Z System.AggregateException:发生一个或多个错误。---> NuGet.Protocol.Core.Types.FatalProtocolException:无法加载源https://microsoft.pkgs.visualstudio.com/_packaging/CBT/nuget/v3/index.json的服务索引。---> System.Net.Http.HttpRequestException: 响应状态代码未指示成功:401(未经授权)。
我在 nuget.config 中有https://microsoft.pkgs.visualstudio.com/_packaging/CBT/nuget/v3/index.json,并且在失败的 PR 中的 nuget.config 中没有任何变化
我可以使用 VS2017 在我的本地机器上成功地恢复和构建整个解决方案。PR 中唯一相关的更改是它使用 packagereference 来获取 nuget 包,而不是使用 package.config。我试图回到使用 package.config,构建仍然会失败并显示相同的错误消息。
提前致谢。
我正在尝试在 Azure DevOps 上为我的 Asp.net Core 项目实施 CI/CD。
具有来自三个不同来源的 Nuget 包的项目:
Azure Pipeline 中的 MSBUild 将仅在 Offline Packages 或 Nuget.org 中找到 nuget 包,但不会找到我也在使用的外部源:http ://dev-abc-api-nugetserver-wi.azurewebsites.net/nuget /
我在 Azure Pipeline Build 中尝试了以下代码,但没有用
/p:RestoreAdditionalSources="http://dev-abc-api-nugetserver-wi.azurewebsites.net/nuget/" /t:Rebuild
Run Code Online (Sandbox Code Playgroud)
但仍然收到同样的错误:
错误 NU1101:无法找到包 abc.Core.Services。源中不存在具有此 ID 的包:Microsoft Visual Studio 离线包,nuget.org
我的构建管道:
msbuild nuget nuget-package-restore azure-devops azure-pipelines
今天我发现自己无法在我的机器上恢复 NuGet 包。这样做会产生类似于以下内容的错误:
Myproject.csproj:错误 NU3034:来自源“ https://api.nuget.org/v3/index.json ”的包“SomePackage 1.2.3” :此包已签名但不是由受信任的签名者签名。
如何修复包还原?
我有一个dotnet core在本地构建良好的项目,但多次抛出以下错误:
Retrying 'FindPackagesByIdAsync' for source 'https://mycontrol.pkgs.visualstudio.com/_packaging/f8292c33-blah-blah-blah-e5e14bb9ba87/nuget/v3/flat2/microsoft.net.test.sdk/index.json'.
Response status code does not indicate success: 401 (Unauthorized).
Run Code Online (Sandbox Code Playgroud)
此错误出现在项目中使用的每个包的 VSTS 构建日志中。
打开链接显示:
{
$id: "1",
innerException: null,
message: "Can't find the package 'microsoft.net.test.sdk' in feed 'MyFeeds'.",
typeName: "Microsoft.VisualStudio.Services.NuGet.WebApi.Exceptions.PackageNotFoundException, Microsoft.VisualStudio.Services.NuGet.WebApi",
typeKey: "PackageNotFoundException",
errorCode: 0,
eventId: 3000
}
Run Code Online (Sandbox Code Playgroud)
虽然我NuGet.Config在项目文件夹中没有一个,但我在父文件夹中有一个:
<?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="_myget.org" value="https://dotnet.myget.org/F/mstestv2/api/v3/index.json" />
</packageSources>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我也会收到此错误(但仅限于日志中的 1 或 2 个包):
C:\hostedtoolcache\windows\dotnet\sdk\2.1.701\NuGet.targets(121,5): error : Failed to retrieve information about 'specflow' from …Run Code Online (Sandbox Code Playgroud) 我在使用 NuGet v4 CLI 将文件复制到输出时遇到了问题。
我的目录结构如下所示:
repo
repo\CodeAnalyzer.nuspec
repo\CodeAnalyzer.props
repo\contentFiles\any\any\StyleCop.ruleset
Run Code Online (Sandbox Code Playgroud)
这是我的 CodeAnalyzer.props 文件:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PackageName>CodeAnalyzer</PackageName>
<PackageVersion>0.1.0</PackageVersion>
</PropertyGroup>
<PropertyGroup>
<CodeAnalysisRuleSet>StyleCop.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
和 CodeAnalyzer.nuspec 文件:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>CodeAnalyzer</id>
<description>Provides standard code analyzer tooling and customisation.</description>
<authors>Me</authors>
<version>0.1.0</version>
<dependencies>
<dependency id="StyleCop.Analyzers" version="1.1.118" />
</dependencies>
<contentFiles>
<files include="any/any/*" buildAction="Content" copyToOutput="true" flatten="false" />
</contentFiles>
</metadata>
<files>
<file src="contentFiles\any\any\StyleCop.ruleset" target="contentFiles" />
<file src="CodeAnalyzer.props" target="build" />
</files>
</package>
Run Code Online (Sandbox Code Playgroud)
在 CLI 上,我使用以下方法打包:
.\nuget.exe pack .\CodeAnalyzer.nuspec
在生成的 .nupkg 中,有一个包含 …
nuget ×8
azure-devops ×5
c# ×4
.net ×2
.net-core ×2
msbuild ×2
asp.net-core ×1
automation ×1
azure-devops-self-hosted-agent ×1
nuget-spec ×1
tfs ×1