Thursday, September 27, 2018

MSBuild: Preprocess file before sending off to compiler

So I'm using a really nice Gtk# binding for my project, and I'm using Glade for the GUI editing. When adding icons, the URI (in the glade XML) is relative to where the Glade file lives. But after editing, I have to manually go into the XML and adjust the paths so that .NET can locate where the images live. E.g.

I have this in the Glade XML after using the GUI editor:

<object class="GtkImage" id="photo"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="pixbuf">photo.png</property> </object> 

But then I have to change the pixbuf line manually afterwards

<property name="pixbuf">PhotoApp/photo.png</property> 

Is there some sort of way in my PhotoApp.csproj file I can add an MSBuild target to look for any lines with pixbuf in them, then do some REGEX magic to correct the URI path? Have to in and do editing like this is quite a pain in the but.

MSBuild: Preprocess file before sending off to compiler Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team