question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XAML files are not supported

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:8
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

14reactions
gulbananacommented, Sep 19, 2017

more complete version of the workarounds i use these days - import this at the end of a csproj

<Project>  
  <!-- https://github.com/dotnet/sdk/issues/810 - the temporary project has the wrong file extension -->
  <PropertyGroup>
    <LanguageTargets>$(MSBuildToolsPath)\Microsoft.CSharp.targets</LanguageTargets>
    <StartWorkingDirectory Condition="'$(OutputType)' == 'WinExe'">bin/$(Configuration)/$(TargetFramework)</StartWorkingDirectory>
  </PropertyGroup>
  
  <!-- Page items aren't included by the SDK -->
  <ItemGroup>
    <Page Include="**\*.xaml" Exclude="@(ApplicationDefinition)" SubType="Designer" Generator="MSBuild:Compile" />
    <Compile Update="**\*.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />
    <UpToDateCheckInput Include="**\*.xaml" />
  </ItemGroup>

  <!-- https://github.com/dotnet/project-system/issues/2488 - .g.cs files don't get built -->
  <Target Name="WorkaroundForXAMLIntellisenseBuildIssue" AfterTargets="_CheckCompileDesignTimePrerequisite">
    <PropertyGroup>
      <BuildingProject>false</BuildingProject>
    </PropertyGroup>
  </Target>
</Project>
8reactions
gulbananacommented, Sep 1, 2017

here are some workarounds for now

issues 1 and 2: <Page Include="**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />

issue 3: <Compile Update="**\*.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />

issue 4: <LanguageTargets>$(MSBuildToolsPath)\Microsoft.CSharp.targets</LanguageTargets>

Read more comments on GitHub >

github_iconTop Results From Across the Web

XAML files are not supported · Issue #1467 · dotnet/project- ...
The only issue I have is when I use globbing - the dependent .xaml.cs files are not nested. Reported there microsoft/VSProjectSystem#169.
Read more >
Xaml files not working properly in my project
I found a solution to this problem.I opened VS installer and then went to VS 2022, clicked on more and opened the "Repair"...
Read more >
Troubleshooting XAML Hot Reload - Visual Studio
If Hot Reload isn't available · Verify that XAML Hot Reload is enabled · Verify that you use Start Debugging rather than Attach...
Read more >
Unable to open XAML files with XAML Designer in Source ...
The XAML designer does not support loose type support. You need to have the solution loaded with your XAML file specified into the...
Read more >
An XAML file may not load correctly after you edit a Team ...
Describes a fix for a problem in which an XAML file may not load correctly after you edit a Team ... A supported...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found