NuGet 包部分下载到错误的目录
首先,我有以下设置:
- MS Visual Studio 2019
- .Net 5 SDK
dotnet --version
: 5.0.405dotnet nuget --version
: 5.11.1.5
这是对于具有以下项目结构的 Azure Functions 项目:
| MyProject.sln
| NuGet.Config
| Packages
| - Contains (at least should) all downloaded NuGet Packages
| Sources
| - Contains all subprojects
NuGet.Config
如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value="Packages" />
</config>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
<packageManagement>
<add key="format" value="1" /> <!-- Using PackageReference -->
<add key="disabled" value="False" />
</packageManagement>
</configuration>
用于存储 NuGet 包的默认目录是%userprofile%\.nuget\packages
。 当我不提供任何 NuGet.Config 文件时,任何 NuGet 包都会放置在那里。
使用上述配置可确保将包放置在项目文件夹 -> 的 \Packages
目录中。没关系!
但是: 当我现在打开 Visual Studio 2019 时,会发生以下情况:
- RESTORE:下载 171 个包并将它们放在应该放置的位置
- 重建项目:下载另外 137 个包并将它们放在 < strong>default nuget 目录
第二步的结果不是我所期望的。
- 我在
NuGet.Config
文件中做错了什么吗? - 这是一种错误吗?
- 或者这是预期的行为,而我的预期是错误的?
First off, I have the following setup:
- MS Visual Studio 2019
- .Net 5 SDK
dotnet --version
: 5.0.405dotnet nuget --version
: 5.11.1.5
This is regarding an Azure Functions project with the following project structure:
| MyProject.sln
| NuGet.Config
| Packages
| - Contains (at least should) all downloaded NuGet Packages
| Sources
| - Contains all subprojects
The NuGet.Config
looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value="Packages" />
</config>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
<packageManagement>
<add key="format" value="1" /> <!-- Using PackageReference -->
<add key="disabled" value="False" />
</packageManagement>
</configuration>
The default directory for storing the NuGet packages is %userprofile%\.nuget\packages
.
When I don't provide any NuGet.Config file, any NuGet package is placed there.
Using the above config ensures, that the packages are placed in the \Packages
directory in project folder -> That's fine!
BUT:
When I now open Visual Studio 2019 to things happen:
- RESTORE: Downloads 171 Packages and places them where they should be placed
- REBUILD PROJECT: Downloads another 137 Packages and places them in default nuget directory
The result of the second step is NOT what I am expecting.
- Am I doing something wrong within the
NuGet.Config
file? - Is this kind of a bug?
- Or is that the expected behaviour and I am wrong with my expectations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论