If you have developed WinRT components referencing resources (such as Generic.xaml resource dictionaries within Themes folders, or other content files that you internally load using msappx protocol) and you need to deploy the output assembly (WinMD file), you’ll need to make sure that the output folder structure is similar to this:
- YourComponent.winmd (assembly file)
- YourComponent (subfolder)
- Themes (subfolder)
- Generic.xaml (resource file)
Otherwise, although the component could compile and working correctly from a project referencing application within same Visual Studio solution, you may receive compile errors indicating that the resource files are not found when you try to reference the assembly directly from a different one.
Visual Studio 2012 for Windows 8 doesn’t seem to deploy the correct folder structure automatically to the output folder. It will place Themes subfolder directly in the same root folder where YourComponent.winmd file is placed.
To resolve the issue, you can configure this post-build script to be run when you build your WinRT component project (you need one line for each resource subfolder, such as Theme, adapted to your naming):
xcopy /s /y “$(TargetDir)\Themes\*.*”