471,334 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,334 software developers and data experts.

Only embed some resources in certain build configurations?

I have some resources in my C# Visual Studio 2005 project that are
involved with self-test. Ideally, they shouldn't be in a released
product.

These resources are embedded by virtue of having their Build Action
property set to Embedded Resource.

Is there any way to add conditions to when they are embedded? For
instance, can I create a build configuration under which they are not
embedded?
Jun 27 '08 #1
3 1463
Yes; not via the IDE, but you can edit the csproj directly (right click,
unload, edit) - add an attribute to the EmbeddedResource element:

<EmbeddedResource Include="Foo.txt"
Condition="'$(Configuration)'=='Debug'" />

(or whichever configuration you want to include it in)

Marc
Jun 27 '08 #2
On 14 Apr, 10:56, Marc Gravell <marc.grav...@gmail.comwrote:
Yes; not via the IDE, but you can edit the csproj directly (right click,
unload, edit) - add an attribute to the EmbeddedResource element:

<EmbeddedResource Include="Foo.txt"
Condition="'$(Configuration)'=='Debug'" />

(or whichever configuration you want to include it in)

Marc
Thanks. That works fine. Is it likely that Visual Studio will
overwrite my hand-edited addition in the future, or is it smart enough
to persist it, once added?
Jun 27 '08 #3
I haven't seen any oddities... you might want to keep an eye on it when
changing from 2005 to 2008, for example, but in general it seems to know
enough to leave it alone...

But if you see any problems...

Marc
Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.