I am trying to write a code generation tool. For this tool, it is important that the generated code is available before construction (i.e. For IntelliSense). I know that Visual Studio will at least partially evaluate the project plan automatically to create IntelliSense, but I canβt find much information about the details.
As a simpler example, let's say I want to take all the elements with an action None string and compile them. I have a project like this:
<Project [...]> [...] <Compile Include="Foo.cs" /> <None Include="Bar.cs" /> </Project>
One way to get Bar.cs to compile is to add the following to your project:
<PropertyGroup> <CoreCompileDependsOn> $(CoreCompileDependsOn);IndirectCompile </CoreCompileDependsOn> </PropertyGroup> <Target Name="IndirectCompile"> <CreateItem Include="@(None)"> <Output ItemName="Compile" TaskParameter="Include" /> </CreateItem> </Target>
If I do this, Visual Studio acts basically the same as if Bar.cs had a Compile action to start with. IntelliSense is fully available; if I made changes to Bar.cs , it reflected immediately (well, as usual, as usual, the background operation) in IntelliSense, when I edit Foo.cs , etc.
However, instead of directly compiling the None entry, say I want to copy it to the obj directory and then compile it from there. I can do this by changing the IndirectCompile target to this:
<Target Name="IndirectCompile" Inputs="@(None)" Outputs="@(None->'$(IntermediateOutputPath)%(FileName).g.cs')" > <Copy SourceFiles="@(None)" DestinationFiles="@(None->'$(IntermediateOutputPath)%(FileName).g.cs')" > <Output TaskParameter="DestinationFiles" ItemName="Compile" /> </Copy> </Target>
This causes IntelliSense to stop updating. The task is working on assembly, dependency analysis and incremental construction work, Visual Studio just stops automatically running it when the input file is saved.
So this leads to the title of the question: how does Visual Studio choose to launch goals or not for IntelliSense? The only official documentation I found was this , in particular the IntelliSense Design Time section. I am sure my code meets all of these criteria. What am I missing?
visual-studio msbuild intellisense
Jacob
source share