Thanks for the code sample. This code has a few problems with it, though a couple of these aren't very obvious as they are specific to how NCrunch utilises MSBuild.
The first issue is that when NCrunch first tries to load your project, it performs an 'analysis build' that involves loading the project file into memory and executing a number of build targets. This analysis build does not specify the $(NCrunchOriginalProjectDir) property - as the project hasn't yet been relocated to a workspace and this property therefore doesn't really make sense yet. It does, however, specify $(NCrunch) == '1', which can cause this code to fail with the missing string/length issue during project load.
The second issue is that when NCrunch loads the project XML into the build runner in preparation for performing the actual build inside the workspace, MSBuild performs an evaluation step over the properties before $(NCrunchOriginalProjectDir) has been defined. This causes the same error case as above, although it happens later in the process (just before a build is started).
The third potential issue is more related to the assumptions this code makes about the structure of the workspace NCrunch has constructed to hold this project. If this workspace doesn't have 'SomeDirInPath' in its path, then things will go wrong. This may be perfectly OK if you have the project set up to use dependencies that exist further up the solution structure and NCrunch's relative path emulation successfully builds the workspace in the way your code is expecting it to be, but I would check this carefully as without upwards relative dependencies being specified from the project, NCrunch assumes that directories above the project's directory aren't important.
Anyway, try the following alternative code:
<BASEDIR Condition="'$(BASEDIR)' == '' AND '$(NCrunchOriginalProjectDir)' == ''">$(MSBuildProjectDirectory.Substring(0, $(MSBuildProjectDirectory.ToUpper().IndexOf(`\SOMEDIRINPATH`))))</BASEDIR>
<BASEDIR Condition="'$(BASEDIR)' == '' AND '$(NCrunchOriginalProjectDir)' != ''">$(NCrunchOriginalProjectDir.Substring(0, $(NCrunchOriginalProjectDir.ToUpper().IndexOf(`\SOMEDIRINPATH`))))</BASEDIR>