KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to write a code generation tool. For this tool it's important that the generated code is available prior to building (i.e., for IntelliSense). I know Visual Studio will at least partially evaluate the project build plan automatically to generate IntelliSense, but I can't find much information on the details. As a simpler example, let's say I want to take all items with build action None 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 the project: <PropertyGroup> <CoreCompileDependsOn> $(CoreCompileDependsOn);IndirectCompile </CoreCompileDependsOn> </PropertyGroup> <Target Name="IndirectCompile"> <CreateItem Include="@(None)"> <Output ItemName="Compile" TaskParameter="Include" /> </CreateItem> </Target> If I do it this way, Visual Studio acts basically the same as if Bar.cs had the Compile action to begin with. IntelliSense is fully available; if I make a change in Bar.cs it's reflected immediately (well, as immediate as the background operation normally is) in IntelliSense when I'm editing Foo.cs , and so on. However, say instead of directly compiling the None entry, 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)" DestinationFi
Tags (comma-separated)
Save Edits
Cancel