-4

Hi I am developing a WPF c# project and want to attach a text file and image file integrated into it so that if I export executable file to any other PC, It will run easily...

  • 2
    Cool project. Good luck! – Sybren Sep 24 '15 at 08:27
  • Add them to the Visual Studio project, set their Build Action to Resource, access them by [Pack URIs](https://msdn.microsoft.com/en-us/library/aa970069(v=vs.100).aspx). – Clemens Sep 24 '15 at 08:30

1 Answers1

0

you are thinking about this in the wrong way, Visual Studio doesn't manage installation on Client machines it only handles building the code for you to run, the thing that manages the installation is the installer

if you want to use a publish installer like click once then you can use Visual Studio to set the publication rules (see https://msdn.microsoft.com/en-us/library/142dbbz4%28v=vs.90%29.aspx), otherwise you actually need to create an installer (see https://msdn.microsoft.com/en-us/library/gg513936.aspx)

EDIT: If i'm misunderstanding your question which i took as how do you get your resourced files to be on the client machine with the exe file, if your question is how to Embed thee resource in the first place then How to refer to Embedded Resources from XAML? provides a very good answer

Community
  • 1
  • 1
MikeT
  • 5,398
  • 3
  • 27
  • 43
  • I want o get data from text file which is atached in "Add Resources" in VS. Kindly first tell me how do I get data and tell me is it portable i.e. can the exe (which I will made with installer) run on other PCs as well... :) – Salman Ali Sep 24 '15 at 08:54
  • If you are just trying to read the data from these files then i would suggest using a XAML resource dictionary as this is comparable with the default. look up process and allows for much greater functionality. otherwise if you look at the Embeding link i provided with explains in detail how to access resources using the different forms of embeding – MikeT Sep 24 '15 at 11:30
  • Once the resources are installed into the correct location via the installer then your code will automatically look them up – MikeT Sep 24 '15 at 11:33