msbuild ASPNETCOMPILER ASPNETRUNTIME startIndex错误

Ben*_*ter 7 msbuild compiler-errors aspnet-compiler .net-4.0 windows-8

我有一个在Windows 7上构建良好的Web项目,没有错误.当我升级到Windows 8时,将项目编译为已编译的网站会引发错误.从csproj文件(不创建一个网站)编译工作正常.这是msbuild抛出的实际错误

ASPNETCOMPILER:错误ASPRUNTIME:startIndex不能大于字符串的长度.[mycsproj.file.here]

msbuild正在运行的抛出错误的行是

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

通过-errorstack标记运行aspnet_compiler,我也能够获得堆栈跟踪,这就是它生成的内容

[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)
Run Code Online (Sandbox Code Playgroud)

我该如何解决?由于堆栈跟踪,我认为它与程序集名称有关,但我不能为我的生活找出解决它的方法.有人可以帮帮我吗?

Dou*_*eny 1

使用 Visual Studio运行“ Clean ”,然后运行“ Rebuild ”。这解决了我的问题。