locked
Metro libraries not supporting XAML pages yet?

    Question

  • Can somebody confirm that the project type "Class Library" for "XAML Windows Metro Style" you can select in Blend for VS2011 does not work, yet?

    VS2011 can create this project type but it does not work right:

    + Blend for VS2011 beta cannot open the project

    + If I add a XAML page, the code behind (xxx.g.i.cs class) is not generated

    + Blend cannot open any XAML page in the referencing application that containing controls hosted in the Class library

    Is this planned and when can we expect this?

    Cheers,

    Chris


    Chris Muench, MVP

    Sunday, March 4, 2012 8:26 PM

All replies

  • Hi Chris, I'll make sure we're tracking this problem if it's not fixed in our current codebase. To answer your question, this is an important scenario for Blend to support but be aware that Blend for VS2011 beta should be thought of as 'alpha' quality.

    Thanks,
    Steve

    Monday, March 5, 2012 1:19 AM
  • Hi Chris,

    I am a tester on the Blend team and would like to make sure I fully understand the problems you are having with Class Library project types.

    It would help me if you could either email or post more detailed steps for this problem.  For example are you creating the Class Library in Blend? or in VS2011? What language(s) are you using?  Is the solution multi-project, single project?  I would also be interested if the order in which the solution and projects are created matters.

    As Steve indicated in his reply, this is an important scenario for Blend so we would like to get to the bottom of any problems might exist here.

    My email address is: <firstname>.<lastname>@microsoft.com, where <firstname>= Sheldon and <lastname> = Johnson. 

    Thanks,

    Sheldon

    Monday, March 5, 2012 11:50 PM
  • This issue is a Blend problem with the side by side installs of Visual Studio 2010 and the newer Visual Studio 2011.  I have confirmed that this issue is being tracked for future releases.

    The problem shows itself in the following error message in Blend:

    The project [...] could not be opened. The imported project "C:\ProgramFiles\MSBuild\Microsoft\WindowsXaml\v10.0\Microsoft.Windows.UI.Xaml.CSharp.Targets"was not found.

    The v10.0 in the path should be v11.0.

     

    The workaround is to set the environment variable  VisualStudioVersion = 11.0

    You can set this environment variable inside of a command shell and then launch the Blend for Visual Studio application from that command shell.

    Also you could set this variable as a system variable in your Control Panel (System Settings -> Advanced Settings -> Environment Variables). 
    Because setting this variable in the control panel would be a global system setting it *might* have some negative implications for the older v10.0 software (Blend 4, Visual Studio 2010).  No full testing has been done with this variable globally set on those previously released products to say for sure if it would have any impact or not, so use the global setting at your own risk.    

    Please mark this reply as the answer to the problem if this workaround helps you. 


    Wednesday, March 7, 2012 11:07 PM
  • For Metro apps, since you don't care about vs2010 backwards compatibility, you can just remove the

    Condition=" '$(VisualStudioVersion)' == '' "

    from the '<PropertyGroup>' tag immediately above the failing .targets file.  This should force-set the version to 11.0 and allow it to open properly in Blend.

    Tuesday, April 3, 2012 12:49 PM