Precompilation during assembly returns an ASPNETCOMPILER (0,0) error: ASPRUNTIME error: startIndex cannot be greater than the string length

This question is similar, but I think it is not the same

msbuild ASPNETCOMPILER ASPNETRUNTIME Error startIndex

I have a web application that I am trying to publish using Visual Web Developer 2010 Express.

If I publish locally or on a production server, it does not matter, and UNCHECK Precompile during publishing everything will work fine, it will publish and work without runtime errors.

However, if I CHECK above, then I get an error message:

 Error 1 startIndex cannot be larger than length of string. ASPNETCOMPILER 0 0 bms 

No other errors and no other information!

Can someone help me even start tracing this?

+7
source share
7 answers

For me, cleaning and restoring, deleting the .obj folder, etc. did not help fix this error.

My solution was as follows:

In VS2013, I right-clicked the project in the solution explorer and selected "publish" and then selected "settings" in the publish dialog. Then I expanded the options for publishing files. Then I clicked the configure link next to "precompile at publish time". Then I did not select "Allow precompiled site to be updated." Then the publication worked for me. If I turned this option off, I could still post it later. Hope this helps.

+3
source

Although this question has been asked for a long time, I recently ran into this error.

In my case, the problem was that I squeezed the disk where the project was saved using the Windows function to save space.

After unpacking the folder in which the web project was saved, the error disappeared.

I hope for this help.

+1
source

I suddenly started getting the same error. I do not know what causes it, but I found several workarounds.

Exit Visual Studio (I'm on VS2012) Delete your obj folder Open Visual Studio and try again.

0
source

In addition to Wayne Brantley’s suggestion to remove the obj folder, I also ran Clean and then Rebuild using Visual Studio. This fixed the problem for me.

0
source

This was because I published the folder in which the old version was published. Select "Delete All Existing Files Before Publishing" "in the Publish Profiles publishing settings that you use.

i.e. make sure you have a clean target build / publish directory so that it doesn't interfere with the compiler, etc.

Update: also check if the published folder in your workspace has a solution, for example. make sure you publish OUTSIDE of your current decision tree, far.

0
source

I had a very similar problem. I can start the publishing wizard in Visual Studio 2012 Pro and publish it normally, but when I start it with msbuild on the command line it will give an error "startIndex cannot be longer than the line length"

I found that this is because I called msbuild without specifying configuration mode. Once I determined the release configuration, it worked.

This is how I earned for my build script

MSBuild "MySolution.sln" /property:Configuration=Release /property:DeployOnBuild="true" /property:PublishProfile="MyPublishProfile"

Hope this helps.

0
source

I also ran into the same problem, then I followed these steps.

  • Open the console.
  • Go to the .net framework directory
  • C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319>
  • Run the following command

C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319> aspnet_compiler.exe -v / -p C: \ Users \ muralidharand \ Source \ Workspaces \ Personal \ ERPv1 \ ERPWeb \ obj \ Debug \ AspnetCompileMerge \ Source -u - d C: \ Users \ muralidharand \ Source \ Workspaces \ Personal \ ERPv1 \ ERPWeb \ obj \ Debug \ AspnetCompileMerge \ TempBuildDir -errorstack

  • Then go back to Visual Studio, clean, rebuild and publish. This works for me in Vs 2013 Professional Edition (sp3).
0
source

All Articles