locked
My Image folder disappear after Publishing my app :/ RRS feed

  • Question

  • Well i creAted a simple wpf app.

    i have in my project an "image" folder which contain a few images i use on my app.

    now the problem is , when i publish it the  image folder is gone :O ?
    Monday, May 18, 2009 8:09 PM

Answers

  • 2 solutions:

    1 Use absolute path
    Uri DataPath = new Uri("c:\\Data\\xmlfile1.xml", UriKind.Absolute);

    2 Use relative path

    Do not forget to include the file into your project and set it as "Copy always"
    • Proposed as answer by Tao Liang Thursday, May 21, 2009 6:50 AM
    • Marked as answer by Salomon112 Thursday, May 21, 2009 9:04 AM
    Thursday, May 21, 2009 6:50 AM

All replies

  • Does the image folder disappear from the solution?


    Abhishek Shukla MCP WPF
    Tuesday, May 19, 2009 6:43 AM
  • Have you include the folder in your solution first?
    Tuesday, May 19, 2009 6:49 AM
  • HI,

    I have this Image folder on my project.

    But when i publish my app there is only setup.exe and Application Files folder which contain some dll etc..


    When i click on setup.exe it run the app and the app start.

    Tuesday, May 19, 2009 2:02 PM
  • Try to set it as "Copy Always"
    Tuesday, May 19, 2009 11:29 PM
  • i think you have not sent the copy option on the files.

    Your app should using paths relative to the exe folder. Otherwise, you might face problems after publishing too.
    Wednesday, May 20, 2009 2:02 PM

  • even i put the BUild Action to content it create wierd images like someimage.jpg.deploy!!!

    My XML file which populate the main window with data doesnt work eather !

    as it create somexmlfile.xml.deploy! and  as i come from web development background these pack:// , many diffrent folders like Application Files, siteupdater_1_0_0_22 etc.. doesnt make any sense!

    usualy when i install a Normal application on my windows it create a folder on program file with image folders , data folders , sound folder etc.. normaly.




    • Edited by Salomon112 Wednesday, May 20, 2009 3:46 PM
    Wednesday, May 20, 2009 3:18 PM
  • When you add project to the setup project, did you check also Documents aside from Primary Output?
    Wednesday, May 20, 2009 3:21 PM
  • by default the publishing options is to set the .deploy extension. You can uncheck this if you want to
    Project properties --> publish tab --> Options button
    click on the deployment option in the list provided in the options dialog.
    Wednesday, May 20, 2009 3:33 PM
  • Well now i have my image folder and xml folder with right content but still it only work when i run it using visual studio.

    but when i publish it  i get
    {"Could not find a part of the path 'C:\\Documents and Settings\\john\\Local Settings\\Apps\\2.0\\9KG12GZP.DAY\\N7D496QM.1QZ\\site..tion_5a5dcd1d8cb7ea08_0001.0000_17ec7ee7dc2ca4f5\\Data\\xmlfile1.xml'."}


    i think that method create the erro which prevent app from runing  btw it run fine on visual studio but gives error when i publish.

     

    public DataSet read()

    {

     

    Uri DataPath = new Uri(@"Data/xmlfile1.xml", UriKind.Relative);

     

     

    DataSet ds = new DataSet();

    ds.ReadXml(DataPath.OriginalString);

     

    return ds;

     

    }

    Wednesday, May 20, 2009 7:44 PM
  • 2 solutions:

    1 Use absolute path
    Uri DataPath = new Uri("c:\\Data\\xmlfile1.xml", UriKind.Absolute);

    2 Use relative path

    Do not forget to include the file into your project and set it as "Copy always"
    • Proposed as answer by Tao Liang Thursday, May 21, 2009 6:50 AM
    • Marked as answer by Salomon112 Thursday, May 21, 2009 9:04 AM
    Thursday, May 21, 2009 6:50 AM