Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

Commented Unassigned: Cannot install NuGet package in portable class library [7147]

$
0
0
#Problem

I have created a portable class library with the same target frameworks as the FluentValidation.Portable project but installing the NuGet package FluentValidation 4.0.0.0 fails with the following message :

> Adding 'FluentValidation 4.0.0.0' to PortableClassLibrary1.
Could not install package 'FluentValidation 4.0.0.0'. You are trying to install this package into a project that targets 'portable-win+net40+sl40+wp80', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I am using the latest version of NuGet (2.6) with a portable library that supports .NET for Windows Store apps, .NET Framework 4 and higher, Silverlight 4 and higher and Windows Phone 8.

#Solution
I have found that the subfolder created in the "lib" directory of the package is named "portable-wp8+sl5+win8" whereas NuGet expects "portable-win+net40+sl40+wp80".

The fix I found is simply to change the "DestinationFolder" attribute of the "Copy" task in the "CreatePackages" target of the "\buildscripts\Deployment.proj" file (line 49 in the commit df5e3df1a5f90792d3516455d3114ecfb74cd61e).

This line :
```
<Copy SourceFiles="@(PortableBinaries)" DestinationFolder="$(PackageDir)\temp\FluentValidation$(PackageSuffix)\lib\portable-wp8%2Bsl5%2Bwin8\%(RecursiveDir)"/>
```
should be :
```
<Copy SourceFiles="@(PortableBinaries)" DestinationFolder="$(PackageDir)\temp\FluentValidation$(PackageSuffix)\lib\portable-win%2Bnet40%2Bsl40%2Bwp80\%(RecursiveDir)"/>
```

I have not created a fork / pull request for this fix as it seems to be an overkill for such a small modification.

#Workaround

If you do not want to wait for the next official release of the packages, here is a workaround :
- Download the NuGet package
- Rename the "portable-wp8+sl5+win8" folder to "portable-win+net40+sl40+wp80" inside the NuGet package.
- Install the package with the "Install-Package" PowerShell cmdlet :
```
Install-Package -Source "D:\MyDownloadedPackages" -Id FluentValidation
```

Thanks.
Comments: Hi Many thanks for investigating this. I've made the change to the build script with one minor change (requires SL5 minimum, not SL4) and deployed a new set of NuGet packages. Please make sure that your Portable library requires SL5 and then try re-installing from the official feed and it should all work now. Please let me know if you encounter any further issues Jeremy

Viewing all articles
Browse latest Browse all 1917

Trending Articles