-
Notifications
You must be signed in to change notification settings - Fork 42
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
Regression for WPF projects in 2.0.24 #158
Comments
With a less minimal repro, we get things like:
And so on... |
Can you share a binlog? compile with /binlog? That line does not control things, it simply removes a FrameworkReference. The decision on wether to use the .NET Core 3 version of the targets vs the built-in one is here: https://github.com/onovotny/MSBuildSdkExtras/blob/master/Source/MSBuild.Sdk.Extras/Sdk/Sdk.props#L23 |
WpfApp1.zip includes msbuild.binlog, built from the below command-line:
|
For completeness, here it is on success with 1.6.68: WpfApp1.zip
|
Thanks. I'll have a look and see what broke as this scenario is supposed to work. As a workaround/better-scenario anyway, I'd suggest installing the .NET Core 3 SDK (currently at preview 3, https://dotnet.microsoft.com/download/dotnet-core/3.0) and adding a global.json like this: {
"sdk": {
"version": "3.0.100-preview3"
},
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "2.0.24"
}
} This will use the updated targets/tasks in the Core 3 SDK for building (you can still target .NET 4.x) and will unblock you. |
FWIW, commenting-out the line that I linked in my local
Thanks -- I've been waiting until General Availability to try it out because even GA releases have been a bit on the bumpy side. |
If you use the Visual Studio stable channel, it won't automatically pickup & use preview SDK's by default. It'll default to the latest stable one. That's why you need the global.json, to tell it to use the preview sdk. The visual studio preview channel will use preview sdk's by default. |
I made a manual patch for our projects via a Directory.Build.targets containing: <ItemGroup Condition=" '$(UseWpf)' == 'true' AND '$(VisualStudioVersion)' == '16.0'">
<None Remove="**\*.xaml" />
<Page Remove="**\*.xaml" />
<Page Include="**\*.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Remove="**\App.xaml" />
<ApplicationDefinition Include="**\App.xaml" />
<Reference Include="System.Xaml" />
</ItemGroup> It seems VS2019 has some fixes in place regarding the xaml -> cs generation that are now handled wrong/duplicated in the MSBuildSdkExtras compared to VS2017 where it was working fine. For us this works fine even if it might not be 100% correct for all setups. I hope this helps others until a real fix can be provided. |
Is there any workaround for this issue that will allow some developers to adopt VS2019 and some to stay on VS2017? Some of us would like to test out VS2019 without forcing the whole team to move. |
The solution from Danielku15 worked for me. In the global.json upgrade to MSBuild.Sdk.Extras version 2.0.24 {
"sdk": {
"version": "2.2.104"
},
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "2.0.24"
}
} Now we gotta make some adjustments to the csproj file. Change <PropertyGroup>
<UseWpf>true</UseWpf>
<ExtrasEnableImplicitWpfReferences>false</ExtrasEnableImplicitWpfReferences>
</PropertyGroup> Next step, add the WPF assembly references: <ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
</ItemGroup> And then, add Danielku15's fix (but without the <ItemGroup Condition=" '$(UseWpf)' == 'true' ">
<None Remove="**\*.xaml" />
<Page Remove="**\*.xaml" />
<Page Include="**\*.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Remove="**\App.xaml" />
<ApplicationDefinition Include="**\App.xaml">
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
</ItemGroup> Now my application builds fine in VS2017 and VS2019 😄 |
Closing due to age. If there's a concrete issue that needs to be addressed in VS 2019 with the .NET Core 3 sdk, please reopen. |
Fix WPF Regression #158 when .net-core 3.0 preview is not installed
Using Visual Studio 2019 RTM, .NET Core SDK 2.2.202.
WPF applications / libraries no longer build with the newly released 2.0.24.
I'm pretty sure this is because this line forces
ExtrasUseWindowsDesktopApp
to betrue
unconditionally when we opt-in to WPF stuff, even thoughtrue
is exactly the value that turns off pretty much all the WPF setup that Extras does.Here's a more-or-less minimal repro, note what happens when switching
1.6.68
to2.0.24
:WpfApp.csproj
App.xaml
MainWindow.xaml
The error I get:
error CS5001: Program does not contain a static 'Main' method suitable for an entry point
The text was updated successfully, but these errors were encountered: