Skip to content

XAML files are not supported #1467

Closed
Closed

Description

@srivatsn

From @tannergooding on February 3, 2017 22:56

Attached is a simple repro solution.
WpfCps.zip

Issue 1: XAML files are treated as None, when they should be treated as Page with Generator=MSBuild:Compile and SubType=Designer metadata.
Issue 2: Page items are not visible in the Solution Explorer
Issue 3: xaml.cs files are not properly nested under the xaml file
Issue 4: Compilation fails with: 1>C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets(419,45): error MSB4057: The target "CoreCompile" does not exist in the project.

Copied from original issue: dotnet/sdk#810

Activity

  1. srivatsn commented on Feb 3, 2017

    @srivatsn
    ContributorAuthor

    From @tannergooding on February 3, 2017 22:56

    FYI. @srivatsn, @jinujoseph, @nguerrera

  2. srivatsn commented on Feb 3, 2017

    @srivatsn
    ContributorAuthor

    From @tannergooding on February 3, 2017 22:57

    This completely blocks the porting of WPF based applications to CPS (I imagine it would also block UWP and anything else that uses XAML).

  3. srivatsn commented on Feb 3, 2017

    @srivatsn
    ContributorAuthor

    Yes WPF and any other desktop projects are not supported yet. Currently only .NET Core projects are supported.

  4. added this to the milestone on Feb 3, 2017
  5. clairernovotny commented on Feb 4, 2017

    @clairernovotny

    This should work with the right LanguageTargets, shouldn't it?

  6. aienabled commented on Feb 6, 2017

    @aienabled

    For me it works good with VS2017 RC and the class library project (.NET Framework, not .NET Standard). I can include XAML files and everything is properly compiled, Intellisense works, etc.
    The only issue I have is when I use globbing - the dependent .xaml.cs files are not nested. Reported there microsoft/VSProjectSystem#169

    UPD. I also checked default class library project (the template with .NET Standard). After switching target to net461 it works but indeed it treats XAML as None... and manual setting it to Page leads to The target "CoreCompile" does not exist in the project error.

  7. aienabled commented on Feb 7, 2017

    @aienabled

    I was able to properly setup XAML files building with CPS for VS2017.
    @onovotny was right, with proper targets it works. I've added <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />. Also I added missing XAML rule for Page. And I've found a workaround for the issue with the dependent .xaml.cs files for files globbing (see link above).

  8. tannergooding commented on Feb 7, 2017

    @tannergooding
    Member

    Ok. I now understand this much better (@srivatsn).

    WPF (and some other project types) generate a temporary project file that does not use the same extension as the original (WPF uses .tmp_proj, for example).

    The SDK.targets uses the project extension to set LanguageTargets (provided LanguageTargets has not already been set). It then imports whatever LanguageTargets is set to (C# should be setting it to $(MSBuildToolsPath)\Microsoft.CSharp.targets, for example).

    So the workaround is to ensure that LanguageTargets is set on any project type that hits the above issue.

    I would think the proper fix, however, is to get the XAML targets (and any other targets that generate temporary projects) to use the original project extension.

  9. aienabled commented on Feb 8, 2017

    @aienabled

    @tannergooding, WPF is using temporary project because it need two-pass building to properly process XAML markup as described in this article on MSDN. So I'm afraid it might not be possible to avoid .tmp_proj.

  10. davkean commented on Feb 8, 2017

    @davkean
    Member

    @aienabled Keep any bugs you file for managed concepts on this repro.

  11. tannergooding commented on Feb 8, 2017

    @tannergooding
    Member

    @aienabled, i wasn't indicating it should avoid .tmp_proj, I'm saying t should usee the original projects file extension when doing so. Meaning instead of .tmp_proj, it should use .tmp_proj.csproj or just .csproj.

  12. srivatsn commented on Feb 8, 2017

    @srivatsn
    ContributorAuthor

    @tannergooding can you file that as an internal bug on XAML?

  13. tannergooding commented on Feb 8, 2017

    @tannergooding
    Member

    @srivatsn, I have logged VSO Bug: 382095 (not sure if the area path is correct, it seemed to be the best fit though).

  14. gulbanana commented on Apr 28, 2017

    @gulbanana

    XAML needs PresentationBuildTasks, right, so is it correct that making this work in the SDK won't automatically make it work with dotnet build?

  15. 40 remaining items

  16. bergmeister commented on Nov 13, 2018

    @bergmeister

    Tried to convert a XAML project to the new project format today and neither the LanguageTargets nor the MSBuild.Sdk.Extras worked although I also use the latest SDK. Given that .Net Core 3.0 is going to come soon, when are we going to see support for this?

  17. gulbanana commented on Nov 14, 2018

    @gulbanana

    There is imperfect XAML support already in the 3.0 nightly builds - pre-alpha stuff, but it’s definutely being implemented. I would expect full support (designer etc) to require vs2019. In the meantime, the workarounds people have described above are still functioning; I have a bunch of WPF libraries and applications using SDK projects.

  18. davkean commented on Nov 14, 2018

    @davkean
    Member
  19. added
    Feature-XAML
    on Dec 12, 2018
  20. modified the milestones: 16.0, 16.1 on Dec 18, 2018
  21. added
    Parity-Legacy-Feature
    on Feb 14, 2019
  22. modified the milestones: 16.1, 16.2 on Apr 2, 2019
  23. davidwengier commented on May 3, 2019

    @davidwengier
    Member

    Closing this as Xaml is now well supported in 16.1 and we have individual issues for the few gaps that remain. If there is a comment in this thread that represents something that is still an issue in Visual Studio 2019 please log a new issue.

    The issues that are still pending for Xaml support can be tracked here: https://github.com/dotnet/project-system/issues?q=is%3Aopen+is%3Aissue+label%3AFeature-XAML

    Other teams will also have work pending (eg. the designer) but the workarounds called out in this thread should generally be no longer needed.

  24. modified the milestones: 16.2, 16.1 on May 3, 2019
  25. DzonnyDZ commented on Aug 6, 2019

    @DzonnyDZ

    I posted possible (nasty) workaround for the issues with 2-pass build here: #5252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature-XAMLParity-Legacy-Feature

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions