【问题标题】:How to resolve ArgumentNullException caused by adding <FrameworkReference> to .nuproj project file?如何解决将 <FrameworkReference> 添加到 .nuproj 项目文件导致的 ArgumentNullException?
【发布时间】:2017-01-06 09:02:55
【问题描述】:

根据NuProj documentation

NuGet 也支持添加对框架程序集的引用。您可以通过 FrameworkReference 项指定它们:

<ItemGroup>
 <FrameworkReference Include="System.dll" />
 <FrameworkReference Include="System.Core.dll" />
</ItemGroup>

但是当我尝试这个(见下文)时,我得到了一个看起来像 ArgumentNullException 的东西——生成的 .nuspec 文件确实包含正确的 &lt;frameworkAssembly&gt; 元素,但是:

1>C:\…\MSBuild\NuProj\NuProj.targets(527,5): error : Value cannot be null.
1>C:\…\MSBuild\NuProj\NuProj.targets(527,5): error : Parameter name: folderName

这是我的.vbproj 文件的一部分:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  …
  <PropertyGroup>
    <NuProjPath Condition=" '$(NuProjPath)' == '' ">$(MSBuildExtensionsPath)\NuProj\</NuProjPath>
  </PropertyGroup>
  <Import Project="$(NuProjPath)\NuProj.props" Condition="Exists('$(NuProjPath)\NuProj.props')" />
  <PropertyGroup Label="Configuration">
    <Id>SomeProject</Id>
    <Version>…</Version>
    <Title>…</Title>
    …
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\SomeProject.vbproj" />
  </ItemGroup>
  <!-- the next ItemGroup is the one I added manually, as shown in the documentation: -->
  <ItemGroup>
    <FrameworkReference Include="System.ServiceModel.dll" />
  </ItemGroup>
  <Import Project="$(NuProjPath)\NuProj.targets" />
</Project>

是我做错了什么,还是 NuProj 的错误?

【问题讨论】:

  • 我在命令行上通过nuget.exe pack 构建包含frameworkAssemblies 的.nuspec 文件时也遇到了这个问题。我发现这个问题的唯一其他参考是:github.com/NuGet/Home/issues/2648

标签: nuget-package nuget-spec assembly-references nuproj


【解决方案1】:

这是 Nuget.exe v3.4.3 的一个问题 - 详细信息如下: https://github.com/NuGet/Home/issues/2648

我可以通过更新到 v3.5.0 来解决这个问题 - 只需在命令行上运行 &gt; nuget update -self

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-18
    • 2015-08-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多