Incremental build does not work for C++ project when using Build Solution command
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 133
Description
We want to extend our C++ project with the support for **proto** files. We defined **ProjectSchemaDefinitions** for ProtoBuf and Visual Studio can recognize such files.
We extended the **BeforeBuildGenerateSourcesTargets** property to execute protoc compiler when C++ project is generating source code files (see Microsoft.BuildSteps.Targets from VC160 toolset).
Out target is correctly called when we run **Rebuild** or the **vcxproj** file is changed. We checked the Inputs and Outputs definitions for the GrpcCompileForCpp target and incremental build detects if proto file changed and GrpcCompileForCpp should be run.
When we use **Build Solution** only, Visual Studio will immediately return **All outputs are up-to-date.** and it does not even run the msbuild. This causes issues when we change proto files - they won't be compiled unless we run Rebuild.
### Steps to reproduce
Project file
```xml
$(BeforeBuildGenerateSourcesTargets);GrpcCompileForCpp
$(MSBuildThisFileDirectory)
"$(ProtocFullPath)" --cpp_out=$(ProtoOutputPath) --grpc_out=$(ProtoOutputPath) --plugin=protoc-gen-grpc=$(GrpcCppPluginFullPath) -I $(ProtoOutputPath) @(ProtoBuf->'%(FullPath)', ' ')
```
Directory contents:
```
/
- Server.proto
- ConsoleApplication4.vcxproj
```
Run **Build** → **Build Solution** command from Visual Studio.
### Expected behavior
Visual Studio will run msbuild and it will detect the **proto** file has changed and it will generate new source code.
### Actual behavior
Visual Studio reports **All outputs are up-to-date.**
### Environment data
Windows 10 1903
Visual Studio 2019
msbuild 16.2.37902.0
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.