Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

msbuild ASPNETCOMPILER ASPNETRUNTIME startIndex error

I have a web project that builds fine on Windows 7 with no error. When I upgraded to Windows 8, compiling the project into a compiled website throws an error. Compiling from the csproj file (not creating a website) works fine. This is the actual error that is thrown by msbuild

ASPNETCOMPILER : error ASPRUNTIME: startIndex cannot be larger than length of string. [mycsproj.file.here]

The line that msbuild is running that is throwing the error is

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p my.physical.project.path -u my.physical.project.path\buildartifacts\CompiledWebsite

I was able to get a stack trace as well from running the aspnet_compiler with the -errorstack tag and this is what it generated

[ArgumentOutOfRangeException]: startIndex cannot be larger than length of string.
Parameter name: startIndex
    at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
    at System.Web.Compilation.DiskBuildResultCache.MarkAssemblyAndRelatedFilesForDeletion(String assemblyName)
    at System.Web.Compilation.DiskBuildResultCache.CacheBuildResult(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
    at System.Web.Compilation.BuildManager.CacheBuildResultInternal(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
    at System.Web.Compilation.WebDirectoryBatchCompiler.CacheAssemblyResults(AssemblyBuilder assemblyBuilder, CompilerResults results)
    at System.Web.Compilation.WebDirectoryBatchCompiler.CompileAssemblyBuilder(AssemblyBuilder builder)
    at System.Web.Compilation.WebDirectoryBatchCompiler.<CompileNonDependentBuildProviders>b__0(AssemblyBuilder assemblyBuilder)
    at System.Web.Compilation.CompilationUtil.CompileParallel(ICollection assemblyBuilders, Action`1 action)
    at System.Web.Compilation.WebDirectoryBatchCompiler.CompileNonDependentBuildProviders(ICollection buildProviders)
    at System.Web.Compilation.WebDirectoryBatchCompiler.Process()
    at System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors)
    at System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors)
    at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
    at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath startingVirtualDir, IEnumerable`1 excludedVirtualPaths)
    at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath startingVirtualDir, IEnumerable`1 excludedVirtualPaths)
    at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCallback callback, IEnumerable`1 excludedVirtualPaths)
    at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback, List`1 excludedVirtualPaths)
    at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback, List`1 excludedVirtualPaths)
    at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback, Boolean forceCleanBuild)
    at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback)
    at System.Web.Compilation.Precompiler.Main(String[] args)

How do I fix this? I assume it has something to do with the assembly name due to the stack trace, but I cannot for the life of me figure out what to do to fix it. Could someone help me out?

like image 400
Ben Guenter Avatar asked Nov 07 '12 18:11

Ben Guenter


1 Answers

Run "Clean" followed by "Rebuild" using Visual Studio. This fixed the problem for me.

like image 121
Doug Domeny Avatar answered Oct 14 '22 05:10

Doug Domeny