8

We use devenv to build our source code on the command line, like this:

devenv xyz.sln /build

I noticed that even though no GUI is open, intellisense is still loaded. Messages like this make me believe this is the case:

[Failure] Could not find file 'C:\xyz\Services\Platform\DataProcessor\WebServiceClient.g.cs'.

This is a generated file, so, of course, it does not exist at the beginning. Anyway, messages like this indicate that intellisense is running and hence resources are wasted.

Can I disable it when devenv builds the code on the command line, but have it enabled otherwise?

Clarification

The build does not fail! This is because there is no problem from the build perspective - the dependency source files are generated before the projects that actually depend on them. So, from the pure build perspective everything is fine.

This error is produced by the Intellisense, which looks forward and notices that some projects reference non existing files. This is totally not needed when devenv is used to build on the command line, on the contrary, it makes noise on the console output.

EDIT 1

We moved away from using devenv for command line builds about a year ago when we migrated to VS 2017. The developers do not seem to experience the concurrency issues we sometimes have with msbuild on the CI servers when running parallel build. This happens when building our Silverlight solution. The CI build sometimes fails complaining about a zip file being in use. Developers do not face it, because they do not compile it very often (it is being phased out, after all).

So, no devenv command line builds any more.

mark
  • 59,016
  • 79
  • 296
  • 580
  • How do you generate that file? – Lasse V. Karlsen Apr 23 '17 at 03:31
  • An exe is running from the csproj BeforeBuild step. And there is another project that already references that file. – mark Apr 23 '17 at 12:03
  • If you directly build this solution in VS, does this failure message appear or not? – Sara Liu - MSFT Apr 26 '17 at 06:58
  • 1
    This is not very plausible, especially when you use devenv.com instead of devenv.exe. What is not so obvious is that devenv does its own dependency checking before it decides to build a project in the solution. Usually passing the job off to msbuild. Clearly it is not going to be thrilled about not being able to do this correctly due to the missing .cs file, so it says something. The best way to avoid fretting about it completely is by not using devenv at all and let msbuild do it. Albeit that this tend to be rejected with "but msbuild doesn't handle the (something old) project type". – Hans Passant May 16 '17 at 10:43
  • There is another reason not to use msbuild - it does not parallelise the building tasks correctly. At least this seemed to be the case a couple of years ago. I suppose this explains why Visual Studio does not hand off the solution itself to msbuild, preferring to determine the build plan itself and then only handing off individual projects to msbuild. On the CI server we do not use devenv to build, obviously, but we are forced to run a single threaded build. – mark May 16 '17 at 17:42
  • MSBuild supports parallelism. I don't know what you mean by correctly though, as I have limited experience using it directly. – Aluan Haddad May 23 '17 at 02:17

1 Answers1

-1

I do not think this is related to indexing (IntelliSense).

This error is caused because solution or project files have a reference to that specific file. If the file is missing from the filesystem at build time you will obtain this error.

I would recommend to review the build order in your project. This article describes how to ensure your project is built in the expected order.

Specifically, try to have the project that generates those source files first, then the rest of the projects that require them.

arboreal84
  • 2,086
  • 18
  • 21
  • But the question is “how to disable VS intellisense when devenv is invoked to build on a command line?” and it is legitimate regardless of what caused OP to ask it. – sam hocevar May 23 '17 at 08:48
  • @samhocevar: That would be the title. But the problem OP describes is that he is obtaining the following error `[Failure] Could not find file 'C:\xyz\Services\Platform\DataProcessor\WebServiceClient.g.cs'.` He attributes that problem to IntelliSense, but that doesn't seem to be the case. If you carefully read his post what he needs is to get past this error to build the project. – arboreal84 May 23 '17 at 08:49
  • The error message *is* issued by IntelliSense. Generated files may be created during the build, but IntelliSense tends to start up very early, so it not always possible to just change the build order. I put a bounty on this question because I too would like to disable IntelliSense when running devenv from the commandline. – sam hocevar May 23 '17 at 10:59