locked
Xaml file locations

    Question

  • Hello,

    I have a large cross platform codebase (gaming related) and I am trying (on and off) to add w8RT / w8phone support. Native only support was rather easy, but providing it can't be used to display ads it's pretty useless for us. XAML seems to be working in test environment but it's hell of a mess once i try to add it next to all other ports.

    In out structure all base sources are in ~/src (static libraries, separated in folders there), project files, build scripts, makefiles etc are in ~/build ( each platform in a separate folder). The games are in ~/app folder and each platform link all necessary libraries from ~/src folders. A single START_GAME( _classname ) macro is defined for each platform to create the application starting point. Actual game sources are platform indifferent.

    Now, correct me if I am wrong, but it's not possible to keep that structure for w8rt_xaml port (let alone w8phone_xaml).

    Lets say I create a project called os_w8rt_xaml in ~/build/w8_xaml, and then I add a xaml file "MainPage.xaml" in it, but changing it's location to ~/src/os_w8xaml/ instead of suggested by visual studio one ~/build/w8_xaml/. The result - the project does not compile. 

    ~\build\w8_xaml\generated files\xamltypeinfo.g.cpp(14): fatal error C1083: Cannot open include file: '..\..\..\..\src\os_w8xaml\MainPage.g.hpp': No such file or directory

    I believe this is actually a bug in visual studio, but I am not sure if that's the only thing preventing me from finishing the port.

    Few questions:

     - Is it possible to have xaml application definition and xaml main page in a static library, and have each application link those in it?

     - If not, is it possible to have those in a dynamic and use them in each application or I should just go ahead and add these 6 files in each of our game projects? (which, unless the above mentioned bug is resolved actually means COPYING those in each project folder. changing anything later will be ridiculously hard.)

     - Can I in any way control where, and how, xaml files are generated - locations, relative source locations, anything?

     - Any news on xaml and windows phone without "c# hoops jumping" ?

    Thanks.

    Thursday, July 11, 2013 12:41 PM

Answers

  • Hi Ludusst,

    I can reproduce the problem with the moved Xaml file. I created a new project, added a new item and placed it in a directory outside of my solution. When building, the reference to the generated file was relative to the source file (as in your case), but the file itself was in the main project directory's "Generated Files" section. You can fix the reference in your own header files, but it doesn't appear that you can fix the reference in the generated XamlTypeInfo.g.h file.

    You can file bugs against Visual Studio yourself on the Visual Studio connect site here.

    I haven't tried it, but you can probably keep your files in a central location and create a symbolic link to them and not have to make copies. I'm not sure offhand how source control systems will handle this.

    Compiling the xaml code into a library should work. You'll need to include both the library and the .xaml files in your project.

    I'm not at my Windows 8.1 Preview machine, but I'll check this out in VS2013 there tomorrow and if it repros I'll file a bug on it.

    For Windows Phone questions please post in the Windows Phone Development forums. We cannot discuss future versions of the OS, only ones which have already been released (currently Windows Phone 8)

    --Rob

    Friday, July 12, 2013 3:17 AM
    Owner