Home: Nuget.exe cannot update package for wixproj

Created on 22 Jun 2016  路  3Comments  路  Source: NuGet/Home

NuGet Version: 3.4.4.1321

When I try to use nuget.exe to update my nuget packages used in a .wixproj I got an error and the packages are not updated.
When I do the update in Visual Studio it work fine. Both in Nuget Package Manager console or Nuget Package Manager UI.

nuget.exe Update SI.Installer.sln -verbosity detailed -NonInteractive -Safe -Prerelease -RepositoryPath .\packages
Scanning for projects...
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Found 1 project with a packages.config file. (SI.Installer.wixproj)
Looking for installed packages in 'packages'.
Feeds used:
D:\B\SI\bin\Release
D:\B\UsedPackages
http://{server}:8080/artifactory/api/nuget/nugetrepository

Attempting to gather dependency information for multiple packages with respect to project '{fullpath}\SI.Installer.wixproj', targeting ''
WARNING: System.InvalidOperationException: Value cannot be null.
Parameter name: projectFramework ---> System.ArgumentNullException: Value cannot be null.
Parameter name: projectFramework
at NuGet.Protocol.Core.v2.DependencyInfoResourceV2.ResolvePackages(String packageId, NuGetFramework projectFramework, ILogger log, CancellationToken token)
at NuGet.PackageManagement.ResolverGather.d__27.MoveNext()

Update NuGet.exe Bug

Most helpful comment

I have experienced the same problem, I tried the 3.5.0-beta2 release and got the same issue.

After some digging I discovered that it could be because the wixproj doesn't include the same target files as a csproj and therefore may not have certain expected properties set.

I inspected the c:\program files (x86)\msbuild folder and found the relevant nuget target files, I was particularly interested in what properties it needed.. From this I have added these to my wixproj under the topmost propertygroup..

<TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkMoniker>.NETFramework,Version=v4.5.1</TargetFrameworkMoniker>
<NuGetTargetMoniker>.NETFramework,Version=v4.5.1</NuGetTargetMoniker>

Not sure how much of these are required, but at least one of these has managed to get me over the above exception..

All 3 comments

Can you please try nuget.exe v3.5.0-beta2 (just released today) -- from http://nuget.org/downloads
Does it show the same problem?

I have experienced the same problem, I tried the 3.5.0-beta2 release and got the same issue.

After some digging I discovered that it could be because the wixproj doesn't include the same target files as a csproj and therefore may not have certain expected properties set.

I inspected the c:\program files (x86)\msbuild folder and found the relevant nuget target files, I was particularly interested in what properties it needed.. From this I have added these to my wixproj under the topmost propertygroup..

<TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkMoniker>.NETFramework,Version=v4.5.1</TargetFrameworkMoniker>
<NuGetTargetMoniker>.NETFramework,Version=v4.5.1</NuGetTargetMoniker>

Not sure how much of these are required, but at least one of these has managed to get me over the above exception..

Thanks for reporting this issue. At this time we suggest moving from packages.config to PackageReference with VS 2017 to resolve your issue. You can find out more about this here: https://blog.nuget.org/20170316/NuGet-now-fully-integrated-into-MSBuild.html

Was this page helpful?
0 / 5 - 0 ratings