George Durzi

in

June 2008 - Posts

WPF/XBAP IOException: Cannot locate resource app.xaml

I'm working on an XBAP project where deploying it involves publishing it as a ClickOnce manifest using Visual Studio 2008's publishing features. I'm working with the RTM version Visual Studio 2008 Professional Edition.

Occasionally, the publishing process would fail for no good reason even though the project compiled successfully. When the publishing process eventually succeeded, I would get the following error when running the application:

IOException: Cannot locate resource app.xaml

After that happened, I wouldn't even be able to run the project in Debug mode from Visual Studio - I would get the same error.

In order to get the project to run again, I would have to open app.xaml, edit it, undo the edit, and save it. Blew my mind.

An extensive Google search showed that most people reported this issue when using the Beta 2 build of Orcas. I can report that this issue still occurs in the RTM version.

I finally figured this out, and am now able to publish my project consistently without ever seeing this error. Here's what my publishing process looks like now:

  1. If your project is under source control, your .csproj or .vbproj needs to be checked out
  2. You need to delete previously published files
    • Delete the contents of publish\
    • Delete the contents of bin\Debug\app.publish
      • or bin\Release\app.publish
    • EDIT: I also noticed that I need to have the "Automatically increment revision with each publish" checkbox on the Publish tab of the project properties checked.

I hope this saves you some frustration.

TechEd 2008 Happenings
Technorati Tags:

I'm going to be at the TechEd bloggers lounge on Wednesday, June 4th from 3 to 4pm to discuss and answer questions about the Unified Communications works Clarity did for the conference.

Here's some of the stuff we'll be showing throughout the week:

  • Office Communicator Presence Controls for WPF
  • Office Communicator Vista Gadget
  • TFS Spy - Visual Studio Add In

It's pretty exciting to be here! I'll be in the Unified Communications area of the Technical Learning Center most of Tuesday and Wednesday.

If you miss any of our demos in the sessions, drop by for a impromptu demo!