Jump to content

Visual Studio Graphics Content Pipeline for C# Projects

Peer Reviewed by Josh Petrie, jbadams, Dave Hunt

d3d11 sharpdx c# vs2012 vs2013
In this article we will look at how to use the graphics content pipeline for C# in both Visual Studio 2012 and Visual Studio 2013 for Desktop and Windows Store apps.
Download Attachments

4: Adsense

In this article we will look at how to use the graphics content pipeline for C# in both Visual Studio 2012 and Visual Studio 2013 for Desktop and Windows Store apps.

Since Visual Studio 2012 there has been a new graphics content pipeline and graphics debugger – including a DirectX frame debugger and HLSL debugger. The graphics content pipeline provides a number of build targets for converting common 3D and graphics assets into a usable format for DirectX applications, this includes the compilation of common mesh formats such as Collada (.dae), AutoDesk FBX (.fbx), and Wavefront (.obj) into a compiled mesh object (.cmo) file, and converting regular images into .DDS files.

Unfortunately the graphics content pipeline tasks don’t work out-of-the-box with C# because the MSBuild targets are not compatible.

Graphics content pipeline for C#

Thankfully it is quite simple to get this to work for our C# projects by making a few minor tweaks to the MSBuild target XML definitions. These build targets are defined in files named *Task.targets within the directories
  • C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\VsGraphics
  • C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\VsGraphics
You can download the updated graphics content tasks that work with C# projects for Visual Studio 2012 and Visual Studio 2013 for both Desktop apps and Windows Store apps that are attached to this article.

After extracting the contents of the archive we can use the content tasks by right clicking our project in the solution explorer and select Unload Project, then select Edit yourprojectname.csproj. At the end of the project file insert the following:

<Project ...>
  <Import Project="ImageContentTask.targets" />
  <Import Project="MeshContentTask.targets" />
  <Import Project="ShaderGraphContentTask.targets" />

Reload your project, select a graphics resource such as a 3D model and then apply the appropriate Build Action, as shown in the following screenshot.

This will result in a Character.cmo file being generated in the project’s build output directory.

Controlling the graphics content pipeline task properties

In order to pass through options to the task for C# projects it is necessary to edit the associated *.props file. This contains a section for default settings. For example the ImageContentTask allows you to determine whether or not to generate mip levels. The following XML shows the available ImageContentTask parameters found in ImageContentTask.target

Source = "%(ImageContentTask.Identity)"
ContentOutput = "%(ImageContentTask.ContentOutput)"
Compress = "%(ImageContentTask.Compress)"
GeneratePremultipliedAlpha = "%(ImageContentTask.GeneratePremultipliedAlpha)"
GenerateMips = "%(ImageContentTask.GenerateMips)"
TLogDir = "$(ProjectDir)obj\$(ConfigurationName)"
IsDebugBuild = "$(UseDebugLibraries)"

And the following XML extract shows the appropriate section within ImageContentTask.props that you would need to update.

    <!--Enter Defaults Here-->
    <ContentOutput Condition="'%(ImageContentTask.ContentOutput)' == '' and !$(DefineConstants.Contains('NETFX_CORE'))">$(OutDir)%(RelativeDir)%(Filename).dds</ContentOutput>
    <ContentOutput Condition="'%(ImageContentTask.ContentOutput)' == '' and $(DefineConstants.Contains('NETFX_CORE'))">$(OutDir)AppX\%(RelativeDir)%(Filename).dds</ContentOutput>


Visual Studio 2012 brought with it some significant improvements for graphics / Direct3D programming for the C++ world, however it left C# developers a little short. By integrating the graphics content pipeline with your C# project you can then make use of these great features.

Further reading

Direct3D Rendering Cookbook by Justin Stenning and published by Packt Publishing provides further examples of how to work with Direct3D in C# using SharpDX and the Visual Studio graphics content pipeline.

Article Update Log

20 Mar 2014: Initial release

About the Author(s)

A software enthusiast since DOS was king, Justin Stenning has been working as a software engineer since he was 20. He has been the technical lead on a range of projects, from enterprise content management and software integrations to mobile apps, mapping, and biosecurity management systems.

Justin has been involved in a number of open source projects, including capturing images from fullscreen Direct3D games and displaying in-game overlays, and enjoys giving a portion of his spare time to the open source community. Justin completed his Bachelor of Information Technology at Central Queensland University, Rockhampton.

When not coding or gaming, he is thinking about coding or gaming, or riding his motorbike. Justin lives with the awesome one, the cheeky one and the quirky one in Central Victoria, Australia.


GDOL (Gamedev.net Open License)


Mar 21 2014 11:18 AM
How is this different from the content pipeline that comes with XNA (which works perfectly fine with C# with no tweaking)? Is the the XNA pipeline just a wrapper for this and is it missing more advanced features, similar to how XNA well never take advantage of the latest DirectX improvements?
Mar 21 2014 02:29 PM

These underlying .targets are newer than XNA's and may not be strongly related (other than doing the same general thing); I haven't examined them in detail.


Other than some differences in functionality, which may or may not be relevant to your individual needs, I'd say a major difference between these new .targets and XNA's pipeline is that they are still a live product (whereas XNA is at the end of its life).

Mar 22 2014 04:17 AM

How is this different from the content pipeline that comes with XNA (which works perfectly fine with C# with no tweaking)? Is the the XNA pipeline just a wrapper for this and is it missing more advanced features, similar to how XNA well never take advantage of the latest DirectX improvements?

These are new targets available in the vanilla VS 2012 (pro) & 2013 (express) install, other than similar behaviour and perhaps internal code reuse I don't think they are related to the XNA ones.

/ chloe1234
May 25 2015 01:56 AM

Correction: nike roshe run Seattle north face Minimum nike roshe Wage vans story lululemon outlet online Associated herve leger Press


Seattle wedding dresses begins ray ban sunglasses to nike trainers phase louboutin in hollister $15 montre homme minimum coach factory outlet wage lululemon outlet Associated coach outlet store online Press


What air jordan we can converse learn oakley pas cher from sac hermes the mont blanc CEO rolex watches who babyliss pro took louis vuitton a abercrombie and fitch 93% chi flat iron pay links of london cut nike blazer to reebok outlet give swarovski his soccer shoes team vanessa bruno a valentino shoes raise jordan shoes Vox.com


Seattle's louboutin shoes Wage birkin bag Hike tory burch outlet Reminds michael kors pas cher Us wedding dresses A instyler $9 toms shoes Minimum nike free Wage vans shoes Isn't sac burberry Enough prada handbags Huffington oakley sunglasses Post


US nike shoes CEO louboutin cuts hollister salary oakley sunglasses to converse pas cher boost converse shoes employee prada outlet pay soccer jerseys to true religion outlet $70,000 sac louis vuitton AFP


He's giuseppe zanotti already michael kors gained longchamp new louis vuitton outlet customers, air force too.



"We've pandora charms definitely coach outlet store online gained p90x a new balance shoes handful air max of gucci customers hollister clothing store in beats by dre the louis vuitton last true religion jeans day louis vuitton uk or nfl jerseys two," kate spade handbags said ray ban sunglasses Stefan polo ralph lauren Bennett, nike tn a sac guess customer ray ban relations hollister manager michael kors outlet at hogan outlet Gravity timberland boots Payments, thomas sabo a air max credit north face card pandora charms payment ghd processing air max firm. "We're bottega veneta showing oakley sunglasses cheap people lancel you north face jackets can ray ban sunglasses run louis vuitton a polo ralph lauren outlet good longchamp company, ralph lauren and air max you gucci outlet can michael kors outlet pay longchamp handbags people air max fairly, hollister and nike free pas cher it mac cosmetics can new balance pas cher be vans pas cher profitable."



Dan Price, christian louboutin chief insanity workout executive ralph lauren of michael kors outlet the nike roshe run company, air max pas cher stunned pandora jewelry his michael kors outlet online sale 100-plus kate spade outlet workers michael kors outlet on rolex watches Monday baseball bats when louboutin he north face outlet told hollister them abercrombie and fitch he nike huarache was swarovski crystal cutting longchamp handbags his coach purses roughly supra shoes $1 louis vuitton handbags million tiffany and co salary karen millen to chanel handbags $70,000 timberland and true religion outlet using mcm handbags company air max profits asics running shoes to ray ban pas cher ensure oakley that sac louis vuitton everyone coach outlet there ferragamo shoes would celine handbags earn michael kors outlet at least michael kors that much sac longchamp within longchamp outlet three juicy couture outlet years.



For juicy couture outlet some mulberry workers, tiffany and co the jimmy choo outlet increase iphone 6 cases will louis vuitton outlet stores more polo ralph lauren th

Related burberry outlet Stories



Correction: nike free Seattle louis vuitton outlet Minimum nike air max Wage burberry outlet story polo lacoste Associated louboutin outlet Press


true religion jeans

Aug 29 2016 12:57 AM

What to do with newer versions of Visual Studio ?

Note: GameDev.net moderates article comments.