By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,930 Members | 1,492 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,930 IT Pros & Developers. It's quick & easy.

Adding an embedded resource without making a local copy

P: n/a
Is there any way to add an embedded resource to a project without copying it
to the project's directory? I have shared resources and don't want each
project using the images, xml files, etc. to need to be updated with the
current copy before being built. I also don't want projects being built with
the old copy.

Thanks!

Bill

Nov 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Wysiwyg <wy*****@xmissionNSPAM.com> wrote:
Is there any way to add an embedded resource to a project without copying it
to the project's directory? I have shared resources and don't want each
project using the images, xml files, etc. to need to be updated with the
current copy before being built. I also don't want projects being built with
the old copy.


Any reason not to have the resources in a single project? You could get
the resources from that assembly, rather than having multiple copies,
one per assembly.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2

P: n/a
Sorry I didn't reply sooner, my usual news server keeps missing messages so
I switched to msnews.microsoft.com and found your reply.

I'm writing a program to install an addon for a business application. The
add on is application event driven and can have several forms, menus, etc.

I have to reference an installer library from the application and write code
for it so I can't just package the install with Wise Installer, MS
Installer, etc. The install exe has to run from the application and sends
events for installation started, in progress, ending, etc. I have to
generate both an installer executable and an add-on executable which is run
by the application. The application I'm writing for requires that the
add-ons be started with executables rather than linking to a dll. The
application also requires that the installer's creator generate an add-on
registration file which contains checksums of both the installer and addon
executables.

I couldn't find a way to link files I need included in the installer exe and
have them included/embedded in the installer file that would be simpler than
creating a resources directory in the installer project, adding (and
copying) all of the files I need to that resources directory as embedded
resources, and subsequently executing a prebuild command for the installer
to copy the current files to this "resources" directory. The installer would
then extract the files from the executing assembly's manifest which start
with "installer.resources." for an example.

I'd like a way to include files on the installer's manifest or a way to link
to another project's manifest and have those resources included within the
install executable regardless of file type. If I was writing a regular
windows app I could just use the MS Installer to package the entire solution
but as it is I have to write everything myself and extract the files myself.

Thanks for any assistance!
Bill Faulk

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Wysiwyg <wy*****@xmissionNSPAM.com> wrote:
Is there any way to add an embedded resource to a project without copying it to the project's directory? I have shared resources and don't want each
project using the images, xml files, etc. to need to be updated with the
current copy before being built. I also don't want projects being built with the old copy.


Any reason not to have the resources in a single project? You could get
the resources from that assembly, rather than having multiple copies,
one per assembly.

Nov 17 '05 #3

P: n/a
Wysiwyg <wy*****@xmissionNSPAM.com> wrote:

<snip>
I couldn't find a way to link files I need included in the installer exe and
have them included/embedded in the installer file that would be simpler than
creating a resources directory in the installer project, adding (and
copying) all of the files I need to that resources directory as embedded
resources, and subsequently executing a prebuild command for the installer
to copy the current files to this "resources" directory. The installer would
then extract the files from the executing assembly's manifest which start
with "installer.resources." for an example.


What did you try in terms of having a class library project which just
contains resources? Presumably you're adding other projects into your
installer - what's different about a class library one? I've a feeling
I'm missing something about your problem...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #4

P: n/a
By resources I don't just mean icons and bitmaps. There xml and dll files
plus at least one exe file which need to be installed as well. The
application doesn't let me just link to a library for the addon. I can't
just call a method in a library to execute my add on. I have to install at
least one exe file that is run from the application where the addon will be
registered. I really don't see how I can include all of these resources in a
class library given the requirements of the application that executes the
installation program and runs the addon. The installation program doesn't
actually need to access any of the resources it installs; It just needs to
put them on the filesystem in the right place. I'm not going to be using
rundll32.exe. :-)

Even if all the installer was required to install was a single executable
from another project and required no other resources I would still have the
original question: How do I include this external file with my installation
without copying it to the installation project?

Thanks!
Bill Faulk

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Wysiwyg <wy*****@xmissionNSPAM.com> wrote:

<snip>
I couldn't find a way to link files I need included in the installer exe and have them included/embedded in the installer file that would be simpler than creating a resources directory in the installer project, adding (and
copying) all of the files I need to that resources directory as embedded
resources, and subsequently executing a prebuild command for the installer to copy the current files to this "resources" directory. The installer would then extract the files from the executing assembly's manifest which start with "installer.resources." for an example.


What did you try in terms of having a class library project which just
contains resources? Presumably you're adding other projects into your
installer - what's different about a class library one? I've a feeling
I'm missing something about your problem...

Nov 17 '05 #5

P: n/a
Wysiwyg <wy*****@xmissionNSPAM.com> wrote:
By resources I don't just mean icons and bitmaps. There xml and dll files
plus at least one exe file which need to be installed as well.
That's fine - they can all be embedded as resources in an assembly.
The application doesn't let me just link to a library for the addon. I can't
just call a method in a library to execute my add on. I have to install at
least one exe file that is run from the application where the addon will be
registered. I really don't see how I can include all of these resources in a
class library given the requirements of the application that executes the
installation program and runs the addon. The installation program doesn't
actually need to access any of the resources it installs; It just needs to
put them on the filesystem in the right place. I'm not going to be using
rundll32.exe. :-)

Even if all the installer was required to install was a single executable
from another project and required no other resources I would still have the
original question: How do I include this external file with my installation
without copying it to the installation project?


By putting it as an embedded resource in your class library assembly,
and making that part of the installation project.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #6

P: n/a
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Wysiwyg <wy*****@xmissionNSPAM.com> wrote:
Even if all the installer was required to install was a single executable from another project and required no other resources I would still have the original question: How do I include this external file with my installation without copying it to the installation project?


By putting it as an embedded resource in your class library assembly,
and making that part of the installation project.


So how would I add an embedded resource to a class library assembly in a way
that's different than adding a file to the project and selecting "embed
resource" as it's build action? If there isn't any other way then that
doesn't gain me anything.

The output for the projects to be installed are not, and will not be, class
librarys since they must be exe files due to restrictions of the application
that will use them. While I can and do put shared resources into class
librarys adding the compiled exe output of other projects into a class
library for the installer does not make sense to me.

I was just looking for a way to embed the exe files that need to be
installed into the installation project without copying them to the actual
directory of said project. If I had to embed those exe files in a class
library then I'd be looking for a way to do so without copying those
resource files to the project of the class library.

Bill Faulk
Nov 17 '05 #7

P: n/a
Actually I found what I was originally asking for. When adding an existing
item there is a drop down next to "open" which allows you to select
"open","open with...", and "link". The link option is what I was looking
for.
Is there any way to add an embedded resource to a project without copying itto the project's directory? I have shared resources and don't want each
project using the images, xml files, etc. to need to be updated with the
current copy before being built. I also don't want projects being built withthe old copy.

Nov 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.