How to include image resources into package

Topics: Writing modules
Sep 8, 2011 at 7:13 PM

Simple question (I hope). 

I have created a module that contains a /Content/Images folder.  How do I package this module so that the image resources are included in the package?  By default, they are not.

Sep 8, 2011 at 7:22 PM

Did you include them in the project file?

Sep 8, 2011 at 7:44 PM

Not explicitly.  How would I do that?

Sep 8, 2011 at 7:49 PM

In Visual Studio, you would "show all files", then right-click the missing file and choose "Include in project". If you are editing it by hand, make sure you have a line such as:

<Content Include="Content\rss.png" />

for each image that you want to include (this is from my Vandelay Industries module project file).

Sep 8, 2011 at 7:54 PM

When I open the project file in a text editor I find:

    <Folder Include="Content\Images\" />
    <Content Include="Content\Web.config">

this would lead me to beleive that the folder is included in the project file.

Sep 8, 2011 at 7:55 PM

Opps, I didn't see your reply.  I will try that.


Sep 8, 2011 at 8:01 PM

Yeah, the thing is, the dynamic compilation provider and the packaging code may not implement the full csproj spec. It will definitely work if you include each file.

Sep 8, 2011 at 8:01 PM

yes, it worked great!  Thanks!

Now I have the following in the project file:

    <Content Include="Content\Images\testimonial_bg.png" />
    <Content Include="Content\Images\testimonial_bg2.png" />
    <Content Include="Content\Images\testimonial_bg_bot_left.png" />
    <Content Include="Content\Images\testimonial_bg_bot_right.png" />