CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Silicon Valley

    Question An issue with the file name SerialPortSettings.xml


    In XAML I’m trying to declare XmlDataProvider objects to bind controls to XML files.
    <XmlDataProvider x:Key="SerialPortOptions" Source="Settings/SerialPortOptions.xml" XPath="//Options" /> <!—- This one works.  No complaints. -->
    <XmlDataProvider x:Key="SerialPortSetting" Source="Settings/SerialPortSettings.xml" XPath="//SerialPorts" /> <!—- But this one gives an error. -->
    The second instance generates an error:
    The file Settings/SerialPortSettings.xml is not part of the project or its 'Build Action' property is not set to 'Resource'.
    The SerialPortSettings.xml file is added to the project and the Build Action is set to ‘Resource’. If I rename the file to SerialPortSettingses.xml, the error disappears. What’s special or unusual about the original file name SerialPortSettings.xml?

    - Nick

  2. #2
    Join Date
    Mar 2004
    Prague, Czech Republic, EU

    Re: An issue with the file name SerialPortSettings.xml

    I think there is nothing special about the name, but maybe it should correspond to the key? In the first case, key is same as filename (SerialPortOptions), in second the key is SerialPortSetting, while file name (you want it to be) SerialPortSettings.xml. There also could be some garbage somewhere in solution/project. Try to delete .suo file and labore with build action, e.g. set it to Embeded Resource and back and so on...
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width