Closed GeertvanHorrik closed 6 years ago
Could this be the result of a different order because of the SDK usage?
Will take a look. Also @kzu, any thoughts as you rearranged a few things to support SDK's :)
Is this reproducible both in sdk usage as well as packgeref usage?
--
-- /kzu from mobile
In package ref, it works fine. It only breaks when using it as SDK.
See this repository:
https://github.com/GeertvanHorrik/MultiTargetingProject
Here is the csproj:
Whenever I make the changes, it breaks.
@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
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.
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:
EnableDefaultWpfItems
to false
as I suggest above.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?
@GeertvanHorrik did that help your issue?
Sorry for my late reply, the "focused inbox" got me on this. Will look into it.
Trying with 1.3.1, but that doesn't work yet. Trying the fix you proposed.
See commit:
Only setting EnableDefaultWpfItems
to false
seems to fix this
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.
Are more people using the extras for multitargeting? I think so, but you now the stats better…
@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.
Just verified that it works with a few changes. Here is the full commit ensuring compatibility with the PR:
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
<Project Sdk="Microsoft.NET.Sdk">
with<Project Sdk="MSBuild.Sdk.Extras/1.2.2">
<Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />
Result