You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

创建NuGet包并发布至内部源后,项目引用时无法显示引用项求助

Hey there! Let’s troubleshoot this frustrating NuGet issue together— I’ve dealt with similar weirdness with internal feeds and pre-release packages before, so here are the most likely fixes to check:

1. First, validate your .nuspec file

Since you mentioned your .nuspec is part of the setup, let’s start here. The most common culprit here is missing or misconfigured <files> nodes, which leads to an empty package (that shows up in the list but has no assemblies to reference).

Make sure you’ve explicitly included your library’s output files, matching your target framework. For example, if you’re targeting .NET Framework 4.7.2:

<files>
  <file src="bin\Release\YourToolLibrary.dll" target="lib\net472" />
  <file src="bin\Release\YourToolLibrary.pdb" target="lib\net472" />
</files>

For .NET 6+/Core, adjust the target path to something like lib\net6.0. If this section is missing or the paths are wrong, NuGet will create a hollow package that installs but adds no references.

Also double-check that the <id> and <version> in your .nuspec exactly match the pre-release version you’re seeing in your internal feed— sometimes typos here lead to installing a different (empty) package by accident.

2. Confirm the package actually has your assembly

Even if the build succeeded, sometimes the VSTS pack step fails silently. To verify:

  • Download the package from your internal NuGet feed, rename its extension to .zip, and unzip it. Look for a lib or ref folder— if it’s empty, your pack step isn’t including your DLL.
  • Dig into your VSTS build logs for the pack task (either NuGet pack or dotnet pack). Look for warnings like "No files were found to include" or target framework mismatches— these are dead giveaways that the package is empty.

3. Check project compatibility

If your tool library’s target framework doesn’t play nice with the project you’re trying to reference it in, NuGet might hide the reference even though the package shows as installed:

  • For example, a .NET 6 library won’t work with a .NET Framework 4.6.1 project— confirm your target frameworks are compatible.
  • For .NET Core/.NET 5+ projects, manually open your .csproj file and check if the <PackageReference> for your library is present. Sometimes the Visual Studio UI glitches, but the reference is actually there. If it’s missing, add it manually:
    <PackageReference Include="YourToolLibraryId" Version="1.0.0-beta" />
    
    Then reload the project to see if the reference shows up.

Pre-release packages can sometimes behave oddly in the NuGet UI:

  • Make sure you’ve checked the Include prerelease box in the NuGet Package Manager when searching for your package— even if you found it, not having this checked can cause display issues post-install.
  • Clear your NuGet cache: Go to Tools → Options → NuGet Package Manager → General, then click "Clear All NuGet Cache(s)". Corrupted cached packages often cause this "installed but not visible" problem.
  • Try restoring via the command line to get clearer error messages. Run this in your project directory:
    dotnet restore --source https://your-company-internal-nuget-feed-url
    
    Any permission issues or feed misconfigurations will show up here.

5. Validate your VSTS build/pack pipeline

If your package is empty, the issue is likely in your build setup:

  • Ensure the dotnet pack or NuGet pack task runs after your build task. If you pack before building, you’ll end up with an empty package (since the DLL hasn’t been compiled yet).
  • If you’re generating a symbols package, make sure your main package still includes the actual assembly— sometimes misconfiguring symbols can push a symbols-only package instead of the full one.

If you can share your actual .nuspec content or any error snippets from your VSTS logs, I can help narrow this down even further!


内容的提问来源于stack exchange,提问作者Matthew The Terrible

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 07:17:07