msbuild ASPNETCOMPILER ASPNETRUNTIME startIndex error

ぃ、小莉子 提交于 2019-12-08 17:41:52

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/13276125/msbuild-aspnetcompiler-aspnetruntime-startindex-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!