How to resolve ArgumentNullException caused by adding <FrameworkReference> to .nuproj project file?

179 views Asked by At

According to the NuProj documentation,

NuGet supports adding references to framework assemblies as well. You can specify those via the FrameworkReference item:

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

But when I try this (see below), I am getting what looks like an ArgumentNullException — the generated .nuspec file does contain the correct <frameworkAssembly> elements, however:

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

This is part of my .vbproj file:

<?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>

Am I doing something wrong, or is this a bug with NuProj?

1

There are 1 answers

0
s3raph86 On BEST ANSWER

This is an issue with v3.4.3 of Nuget.exe - details here: https://github.com/NuGet/Home/issues/2648

I was able to resolve this by updating to v3.5.0 - just run > nuget update -self on the command line.