Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 50 lines (31 sloc) 2.204 kb

.NET 3.5

There are some things to know about how Cassette makes itself backwards compatible with .NET 3.5. We've tried to make shims as invisible as possible, but unfortunately this isn't Javascript so we had to make a few sacrifices.

Use Cassette.FX35.sln

To develop against .NET 3.5, please use the Cassette.FX35.sln file; as it manages the Debug/Release configurations for you automatically.

"string".IsNullOrWhiteSpace()

Instead of String.IsNullOrWhiteSpace(string) use "string".IsNullOrWhiteSpace() extension method (Cassette.Utilities).

PathUtilities.Combine

When combining an array or more than 2 paths, use PathUtilities.Combine instead.

String.Join gotcha

In .NET 3.5, String.Join does not accept IEnumerable as a valid array. You must use .ToArray() on any enumerables.

HashedSet

.NET 3.5 does not support the ISet<T> interface for HashSet<T>, so we utilize Iesi.Collections to provide that support. Please use the custom class, HashedSet<T> which provides native HashSet functionality for .NET 4 and uses Iesi for 3.5.

Upgrading Nuget packages / csproj Gotchas

Cassette does conditional includes of Nuget references in all csproj files. Make sure you take a look at the projects affected by any new upgrade and afterwards, add back the condition in order to not break .NET 3.5 projects.

Conditional References

If a project file requires a .NET 3.5- or .NET 4.0-specific assembly, use conditional a <reference> in the csproj file. For example:

<!-- For a single assembly: -->
<reference Condition="'$(TargetFrameworkVersion)' == 'v3.5'" ...>
    <SpecificVersion>false</SpecificVersion> <!-- Important! -->
    <HintPath>...</HintPath>
</reference>

<!-- For multi-targeted assemblies: -->
<reference ...>
    <SpecificVersion>false</SpecificVersion> <!-- Important! -->
    <HintPath Condition="'$(TargetFrameworkVersion)' == 'v3.5'">...</HintPath>
    <HintPath Condition="'$(TargetFrameworkVersion)' == 'v4.0'">...</HintPath>
</reference>

Do run build.bat often

When making changes, to double-check you didn't break .NET 3.5 compatibility, run build.bat often, or at least before committing any changes.

Something went wrong with that request. Please try again.