I'm working on a project where we have a build tool that automatically generates source files during the build process and compiles them in. However, this setup makes us unable to get intellisense or any autocompletion when working with these generated classes. I was wondering if there was a way we could include these files as an intellisense reference without actually compiling them.
The idea being that we could copy the generated source to the target folder as part of the build task, which would then be able to be used for autocompletion, without breaking our system. I know that I can include all the contents of this folder automatically, but setting Build Action to None does not give any autocomplete functionality it would appear.
We are using Visual Studio 2013.
So with the help of my coworkers we found a very effective solution to this problem.
Basically, MSBuild uses <CompileDependsOn>
to determine where to get intellisense from. <CompileDependsOn>
is supplied with a semicolon-delimited list of targets which add files to <Compile>
.
For our situation, for the projects which needed intellisense, we added the following lines to the project.
<PropertyGroup>
<CompileDependsOn>
customTarget;$(CompileDependsOn)
</CompileDependsOn>
</PropertyGroup>
Where customTarget
is the target which adds the generated files to <Compile>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With