I am trying to use the MSBuild: Compile generator to start compiling my custom file type when the file is saved in Visual Studio (should work as a custom tool, but with msbuild). The build process itself works, but it does not work if the file is saved.
Can someone explain what exactly MSBuild does: compilation record? So far, I just saw this used in antlr msbuild scripts and for XAML.
Below I have an excerpt from the msbuild installation, which I use to compile the * .myext file into the * .g.ts file.
My goals file:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <UsingTask TaskName="SampleNamespace.CustomCompilerTask" AssemblyFile="MyTask.dll" /> <PropertyGroup> <PrepareResourcesDependsOn> CustomLayoutCompile; $(PrepareResourcesDependsOn) </PrepareResourcesDependsOn> </PropertyGroup> <ItemDefinitionGroup> <CustomTypeCompile> <Generator>MSBuild:Compile</Generator> </CustomTypeCompile> </ItemDefinitionGroup> <Target Name="CustomLayoutCompile" Inputs="@(TypeScriptCompile);@(CustomTypeCompile)" Outputs="@(CustomTypeCompile->'%(RootDir)%(Directory)%(Filename).g.ts')"> <CustomCompilerTask TypeScriptFiles="@(TypeScriptCompile)" LayoutFiles="@(CustomTypeCompile)" /> </Target> </Project>
Entries in the project file:
.... <ItemGroup> <TypeScriptCompile Include="MyControl.ts"> <DependentUpon>MyControl.myext</DependentUpon> </TypeScriptCompile> <TypeScriptCompile Include="MyControl.g.ts"> <DependentUpon>MyControl.myext</DependentUpon> </TypeScriptCompile> </ItemGroup> <ItemGroup> <CustomTypeCompile Include="MyControl.myext"> <Generator>MSBuild:Compile</Generator> </CustomTypeCompile> </ItemGroup> .... <Import Project="path/to/my/target/file/mytargets.targets" /> ....
Fionn source share