Pre-Compile During Build returns Error ASPNETCOMPILER(0,0): Error ASPRUNTIME: startIndex cannot be larger than length of string
Asked Answered
S

7

7

This question is similar, but I think not the same

msbuild ASPNETCOMPILER ASPNETRUNTIME startIndex error

I have a Web Application which I am trying to publish using Visual Web Developer 2010 Express.

If I publish, locally, or to production server, it makes no difference and UNCHECK Precompile during publishing everything will work fine, it'll publish and work, with no run time errors.

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

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

No other errors, and no other information!

Can anyone help me even begin to trace this?

Sparoid answered 5/5, 2013 at 10:16 Comment(0)
A
3

For me, Clean and rebuild, deleting .obj folder etc. did not help resolve the error.

My solution was as follows

In VS2013, I right clicked the project in solution explorer and selected 'publish', then selected 'settings' in the publish dialog. Then I expanded 'file publish options'. Then I clicked the configure link next to 'precompile during publishing'. Then I unselected 'Allow precompiled site to be updatable'. Then publishing worked for me. If I undid that selection I could still publish afterward. Hope this helps.

Agrostology answered 23/1, 2014 at 16:5 Comment(1)
This fixed for me.. I had to unselect the 'Allow precompiled site to be updatable' to get things working!! Thanks :)Venepuncture
S
1

Although this question was asked long time ago, I've recently come across this error.

In my case the problem was that I had compressed the drive where the project was stored using the windows feature to save space.

After uncompressing the folder where the web project was stored, the error disappeared.

Hope this help.

Sadirah answered 21/10, 2015 at 17:13 Comment(0)
M
0

I have all of a sudden started getting this same error. I do not know what causes it, but I have found somewhat of a workaround.

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

Mattoid answered 23/5, 2013 at 16:29 Comment(0)
P
0

In addition to Wayne Brantley's suggestion of deleting the obj folder, I also ran "Clean" followed by "Rebuild" using Visual Studio. This fixed the problem for me.

Peahen answered 29/8, 2013 at 17:22 Comment(0)
B
0

It was caused by me publishing into a folder that had an old published version in it. i.e. Choose the "Delete all existing files prior to publish" option on the Publish Profile Setttings you are using.

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 that there is no published folder in your working solution's space, e.g. make sure you publish OUTSIDE of your current solution's tree, far away.

Beach answered 17/11, 2013 at 23:29 Comment(1)
@JPHellemons also check that there is no previously published folder in your working solution's space, e.g. make sure you publish OUTSIDE of your current solution's tree, far away.Beach
C
0

I had a very similar problem. I could run the publish wizard in Visual Studio 2012 Pro and it would publish ok but when running it with msbuild on the command line it would give the error "startIndex cannot be larger than length of string"

I discovered that it was because I was invoking msbuild without specifying the configuration mode. Once I specified the release configuration it worked.

This is how I got it to work for my build script

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

Hope that helps.

Cornew answered 9/2, 2014 at 17:58 Comment(0)
D
0

I also faced the same problem,then I followed the steps.

  • Open the Console.
  • Go to the .net framework directory
  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319>
  • Execute the below 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 come back to Visual Studio, do clean, rebuild and publish. This is worked for me in Vs 2013 Professional Edition (sp3).
Dyadic answered 13/12, 2014 at 8:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.