0

Following the technique here, I got the vbc command line used to compile my project. I've used this to compile the project from the command line and it's worked fine the several times I've tried it. The command line is about 25,000 characters long, if that means anything.

But today when I ran the command, I got a bunch of errors that look like this:

vbc : Command line error BC2001 : file 'admin\TestShare.aspxvb' could not be found

However, when I look at the actual command line for the reference to that file, it's correct:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Vbc.exe ... admin\TestShare.aspx.vb ...

All of the other "file could not be found" errors are similar: it's dropping characters from the filename (not just dots but text characters as well), and then it says it can't find that file.

What's going on here?

Update: That first bad file is right near character 8192 in the command line, which suggests that the problem is related to the path being too long for Windows. But if this is the problem, how can I build my app from the command line?

Community
  • 1
  • 1
Joshua Frank
  • 13,120
  • 11
  • 46
  • 95
  • Any reason you can't use `msbuild YourProject.proj` from the command line? it's a bit shorter ;-) – Chris O Dec 26 '13 at 15:35
  • Taking a wild guess: if you get such ginormous command lines then you must be compiling projects that are nested very deep inside many subdirectories. Things go wrong when you exceed the hard upper limit on the length of a winapi file name, 259 characters. Move your solution closer to the root. – Hans Passant Dec 26 '13 at 15:39
  • @ChrisO: D'oh, because I didn't think of it. Somehow I got fixated on the vbc approach and never backed up and thought of a different way. I tried msbuild and it addressed my problem. If you post your comment as an answer, I'll accept it. – Joshua Frank Dec 26 '13 at 18:13
  • @HansPassant: The main source of length is filenames, but they seem to use relative paths, so that's not going to help. But ginormous paths is clearly a sign of a bad approach, and Chris O gave me a much better way. Thanks to both of you for your input. – Joshua Frank Dec 26 '13 at 18:15
  • I fully assumed that msbuild generated this command line. You *typed* in by hand? Ouch. – Hans Passant Dec 26 '13 at 18:17
  • Oh no no no. It was a dumb moment, but not **that** dumb. I lifted the command line from the VS build output. – Joshua Frank Dec 26 '13 at 18:44

1 Answers1

1

If you just need to build from the command line, why not use msbuild instead? All that is necessary is a msbuild YourProject.proj to get things rolling, and much shorter than the verbose way ;-) Run from VS command prompt.

Chris O
  • 5,017
  • 3
  • 35
  • 42