Custom build action properties in a Visual Studio C# project -
in visual studio c++ project can define custom build actions , corresponding property rules (see cl.xml under msbuild folder). how can create such rule custom build action in c# project? under msbuild folder there's file microsoft.csharp.currentversion.targets references csharp.projectitemsschema.xaml, csharp.xaml , csharp.browseobject.xaml looks exacltly definitions need. using procmon can see these files not accessed @ all. what's correct way define custom build actions?
to clarify want accomplish here's example:
- i add image file (.png) project
- i have special image resource 'compiler' transform image (this compiler defined using msbuild target)
- i want change properties of image file (e.g. target resolution, format, etc.). in c++ project can open file property dialog this. these properties saved msbuild item metadata , forwarded msbuild target.
the resulting project file contain data this:
<itemgroup> <myimagecontent include="image.png"> <outputname>myimage.png</outputname> <targetresx>512</targetresx> <targetresy>256</targetresy> </myimagecontent> </itemgroup> this additional metadata can used custom msbuild target. far know how it.
but: in vc++ project metadata can edited in property window provided visual studio. definition visual studio uses comes rules xml file similar cl.xml mentioned. how can accomplish in c# project?
what's correct way define custom build actions?
you can use msbuild targets or imported .targets file define custom build actions in project file.
1.i add image file (.png) project build action, can use copy task in target copy image file project folder:
<target name="copyfiles"> <copy sourcefiles="@(mysourcefiles)" destinationfolder="c:\myproject\destination" /> </target> 2.i have special image resource 'compiler' transform image (this compiler defined using msbuild target)
for build action, can import msbuild target.
3.i want change properties of image file.
in c# project, properties of image saved msbuild item metadata , forwarded msbuild target.
update:
- in vc++ project metadata can edited in property window provided visual studio. definition visual studio uses comes rules xml file similar cl.xml mentioned. how can accomplish in c# project?
as far know not make custom items have additional metadata editable in property window. can applied c++ , c++/cli projects. .net projects (c# , visual basic) don’t have many options tweaked. can refer sharing project properties in visual c++ more detail.
hope can you.

Comments
Post a Comment