I'm writing an MSBuild task to upgrade a database (full source here) and encountered an error/by design feature I don't know how to deal with. Basically, if I declare:
public int? TargetVersion
{
[DebuggerStepThrough]
get { return targetVersion; }
[DebuggerStepThrough]
set { targetVersion = value; }
}
and then attempt to assign a value in an .msbuild
file:
<Target Name="Upgrade">
<UpgradeDatabase ... TargetVersion="10" />
</Target>
MSBuild freaks out and says that
error MSB4030: "10" is an invalid value for the "TargetVersion" parameter of the "UpgradeDatabase" task. The "TargetVersion" parameter is of type "System.Nullable`1[System.Int32]".
How do I assign a value to a nullable property?