Search code examples
c#visual-studio-2012nugetsharpdx

NuGet package (SharpDX) fails to install with error in VS2012


I'm trying to install SharpDX v2.6.2 via NuGet Package Manager console. I kept getting errors so I tried a completely new WPF solution. Here are the steps I've tried and resulting error message:

1. Create a completely New WPF Application, Target .NET4.0

enter image description here

2. Open up Package Manager Console and run the Install command

From the SharpDX NuGet Page

>> PM Install-Package SharpDX

However, this fails with the following output in the Package Manager Console

Package Manager Console Host Version 2.0.30625.9003

Type 'get-help NuGet' to see all available NuGet commands.

PM> Install-Package SharpDX
Successfully installed 'SharpDX 2.6.2'.
Successfully added 'SharpDX 2.6.2' to SharpDXTest.
Installing [SharpDX] to project [C:\Users\Andrew\SharpDXTest\SharpDXTest\SharpDXTest.csproj]
Uninstalling [SharpDX] from project [C:\Users\Andrew\SharpDXTest\SharpDXTest\SharpDXTest.csproj]
Successfully uninstalled 'SharpDX 2.6.2'.
Install failed. Rolling back...
Install-Package : SharpDX.targets import not found in project [C:\Users\Andrew\SharpDXTest\SharpDXTest\SharpDXTest.csproj]
At line:1 char:1
+ Install-Package SharpDX
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], RuntimeException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

I'm totally stumped! :S Other packages seem to install just fine, but SharpDX doesn't. Any suggestions?


Solution

  • Update: I managed to fix it. I basically had to install the latest version of NuGet (v2.8.2) not v2.0.

    Also performing the install in VS2013 seemed to have better results on an existing solution than 2012.

    Hope this helps someone,