Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS 2017 15.6+ breaks UAP builds #43

Closed
GeertvanHorrik opened this issue Mar 14, 2018 · 16 comments · Fixed by #84
Closed

VS 2017 15.6+ breaks UAP builds #43

GeertvanHorrik opened this issue Mar 14, 2018 · 16 comments · Fixed by #84

Comments

@GeertvanHorrik
Copy link
Contributor

GeertvanHorrik commented Mar 14, 2018

I just wrote a post with the following example repository:

https://github.com/GeertvanHorrik/MultiTargetingProject/blob/master/src/Ghk.MultiTargeting/Ghk.MultiTargeting.csproj

Then I read about the new 15.6 method to include the references, so I made the following changes.

Changes

  1. Replace <Project Sdk="Microsoft.NET.Sdk"> with <Project Sdk="MSBuild.Sdk.Extras/1.2.2">
  2. Remove <Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />
  3. Remove the package reference to MSBuild.Sdk.Extras

Result

========================================
Build
========================================
Microsoft (R) Build Engine version 15.6.82.30579 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Source\MultiTargetingProject\src\Ghk.MultiTargeting\Platforms\uap10.0\Views\MyView.xaml(1,23): error MC3074: The tag 'UserControl' does not exist in XML
namespace 'using:Catel.Windows.Controls'. Line 1 Position 23. [C:\Source\MultiTargetingProject\src\Ghk.MultiTargeting\Ghk.MultiTargeting.csproj]
C:\Source\MultiTargetingProject\src\Ghk.MultiTargeting\Platforms\uap10.0\Views\MyView.xaml(1,23): error MC3074: The tag 'UserControl' does not exist in XML
namespace 'using:Catel.Windows.Controls'. Line 1 Position 23. [C:\Source\MultiTargetingProject\src\Ghk.MultiTargeting\Ghk.MultiTargeting.csproj]
An error occurred when executing task 'Build'.
Error: One or more errors occurred.
        MSBuild: Process returned an error (exit code 1).
@GeertvanHorrik
Copy link
Contributor Author

Could this be the result of a different order because of the SDK usage?

@clairernovotny
Copy link
Collaborator

Will take a look. Also @kzu, any thoughts as you rearranged a few things to support SDK's :)

@kzu
Copy link
Contributor

kzu commented Mar 17, 2018 via email

@GeertvanHorrik
Copy link
Contributor Author

In package ref, it works fine. It only breaks when using it as SDK.

@GeertvanHorrik
Copy link
Contributor Author

@clairernovotny
Copy link
Collaborator

@GeertvanHorrik Still investigating, but it looks like something in the WPF target defaults is interfering:

Setting <EnableDefaultWpfItems>false</EnableDefaultWpfItems> in your properties seems to get it compiling using the SDK syntax.

Still not sure what's different in the ordering. Would love any thoughts @kzu

@clairernovotny
Copy link
Collaborator

For testing/creating a simple repro, I added a new test project in this repo in tests\ClasslibWithNuGetSdkRef. make sure to build msbuild.sdk.extras first as it creates the temp package needed by the other one project.

Would be great if we can get an isolated repro there.

@clairernovotny
Copy link
Collaborator

clairernovotny commented Mar 25, 2018

I suspect what's going on is in here:
https://github.com/onovotny/MSBuildSdkExtras/blob/aa3e822ea43a24222ea6c230011c8b327d431782/MSBuild.Sdk.Extras/build/platforms/languageTargets/Wpf.targets#L21-L28

The WPF targets are including everything as a page by default.

I think the proper fix is two-fold:

  1. Setting EnableDefaultWpfItems to false as I suggest above.
  2. Updating those patterns to work with Add support for smart platform defaults and nesting in the IDE #47. The trick there is knowing the difference if we should include files in the root instead of just the Platforms folder in case it's "just" a sdk-style WPF app without multi-targeting (like NuGet Package Explorer).

I'm still not sure why it worked as a PackageReference since based on the above, it shouldn't have?

@clairernovotny
Copy link
Collaborator

@GeertvanHorrik did that help your issue?

@GeertvanHorrik
Copy link
Contributor Author

Sorry for my late reply, the "focused inbox" got me on this. Will look into it.

@GeertvanHorrik
Copy link
Contributor Author

Trying with 1.3.1, but that doesn't work yet. Trying the fix you proposed.

GeertvanHorrik added a commit to GeertvanHorrik/MultiTargetingProject that referenced this issue Apr 11, 2018
@GeertvanHorrik
Copy link
Contributor Author

See commit:

GeertvanHorrik/MultiTargetingProject@2fa1240

Only setting EnableDefaultWpfItems to false seems to fix this

@clairernovotny
Copy link
Collaborator

Yeah, the issue is with the default Page glob. Not sure what the right balance is for this, getting a single WPF target vs multi-target where different project types share the XAML file extension.

@GeertvanHorrik
Copy link
Contributor Author

GeertvanHorrik commented Apr 11, 2018 via email

@Nirmal4G Nirmal4G mentioned this issue Jun 20, 2018
5 tasks
@Nirmal4G
Copy link
Contributor

@GeertvanHorrik Can you make your template work with the package built using the recent commit on my PR?

You can put your project folder into TestProjects folder in the repo and make your changes, it'll automatically picks up latest extras when you build the repo solution first and then yours.

@GeertvanHorrik
Copy link
Contributor Author

Just verified that it works with a few changes. Here is the full commit ensuring compatibility with the PR:

GeertvanHorrik/MultiTargetingProject@0b7a8de

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants