locked
Problem: Xbap won't design xaml in subfolders; IDE goes "Whoops"

    Question

  • In Visual Studio 2k5, I create an Xbap app, runs fine w/ F5, displays in IE 7 no problem.  The App.xaml <Application> element has an attribute StartupUri="HomePage.xaml" which is correct, app runs, no problems.

    In the project, if I use Add New Item to add a Page (WPF) in the default (base) folder, it works fine.  The IDE designer works, the page can be navigated to at runtime, everything's great.

    If I try Add New Item and create a page in a subfolder, the page is created as before (with the xaml & .cs) but the xaml won't design visually.  If I try to flip to the design tab, I get a Whoops message, saying error reading designer file.  The App.xaml file's <Application> element's StartupUri attribute now shows as an error, saying I can't assign "HomePage.xaml" to that attribute.

    If I move a working page from the base folder to a subfolder, same error.  Move that file back to the base folder, everything's fine.

    Has anyone run into this?  I'm sure it's a namespace problem of some sort, but nothing I've tried helps.

    Thanks!

    Friday, February 09, 2007 6:18 PM

Answers

All replies

  • You are probably best to search and post your bug here https://connect.microsoft.com/VisualStudio.

    Thanks.

    Friday, February 09, 2007 6:25 PM
    Moderator
  • What CTP of the "VS Extensions for WPF & WCF" are you using?
    Wednesday, February 14, 2007 1:55 AM
    Moderator
  • A workaround for this issue is to update the value of StartupUri in the Application.xaml file. So if Page2.xaml is in subfolder "MySubDirectory", then the Application.xaml file should read:

    <Application x:Class="App"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        StartupUri="MySubDirectory\Page2.xaml">

    </Application>

     

    HTH
    -Patrick

    Wednesday, February 14, 2007 11:51 PM
  • Hi Kary,

     

    I have just come across exactly the same issue that you were having (I assume you have found a workaround now)... but I thought I'd post here as this was the only place on the internet that I found this problem mentioned, whilst googling.

     

    I think it must be a bug in the IDE and the only way I have found to work around this issue is by removing the 'StartupUri' from App.xaml.  Of course, now, the application does not run at all.  Instead, in the code behind for the App.xaml, put the following (in VB):

     

    Public Sub New()

       Me.Run(New MainWindow)

    End Sub

     

      This should now allow you to use the built in designer for xaml in sub folders without the IDE complaining!

     

    Cheers,

    DaveD

    Friday, June 01, 2007 10:07 AM