Hi Carl,
First, you need to change Copy to Output Directory of your XML file to Copy if newer in your XML file properties page.
Then have you included your XML file when you publish the Windows Forms application?
If not, please follow the steps:
1.Go into your Project's properties-> publish tab ->Click "Application Files".
2.Find your xml file in the list and change the "Publish Status" of your file to "Include". And the value of "Download Group" is"Required".
Finally, you need to get full path of XML file to load.
var fullpath = AppDomain.CurrentDomain.BaseDirectory+ "XMLFile1.xml";
XDocument doc= XDocument.Load(fullpath);
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.