-
Notifications
You must be signed in to change notification settings - Fork 44
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
Cannot update from 1.5.4 or use in VS2019 #167
Comments
Unfortunately, 1.x will not work in VS 2019 due to changes in MSBuild file locations. You do need 2.x for that. The UWP issue is this bug and the fix will be in 16.1.2 (which isn't out yet): dotnet/project-system#4854 What versions of the .NET Core SDK do you have? ( |
Can I use 2.x in VS4mac? I have Core 3.0.100-preview5-011568. |
See #168 (comment) |
So you're saying 2.x is required for VS2019, but it does not work currently. VS 16.1.2 should fix it. I know that VS4Mac only builds the first target framework, but I'm fine with that as I build the others on Windows. Currently I build all platforms but Xamarin.Mac20 on Windows, then build that on the Mac, copy the result over to Windows and then do |
Everything should work with 2.0.29, I just tested with Xamarin.Essentials and looks like it is better now. Need @onovotny to push to stable please :) |
@jamesmontemagno just pushed 2.0.29 to NuGet |
I still cannot update it. My VS has version 16.1.3 now. I tried to update to 2.0.29. The initial error when opening the solution is gone, but I can't compile the project. There are still errors because it tries to compile with the wrong platform. VS claims that it can't find the In the error list it looks like it wants to compile it for netstandard1.0 although that is not in the leftmost dropdown for the platform for the file. From the Output window:
In other files (which are also in the WPF folder and should only be used for that platform) I also get errors like these:
My .csproj looks like this (only relevant parts included):
The solution explorer doesn't show any dependency problems: When I try to update MSBuild.Sdk.Extras via "Manage NuGet Packages for Solution", then I get
Because you also asked for the .NET Core SDK before - I also updated that in the meantime to 3.0.100-preview6-012264. But the C:\Program Files\dotnet\sdk\3.0.100-preview6-012264\Sdks folder does not contain anything like MSBuild.Sdk.Extras*. Do I have to do anything special to download it or do I look in the wrong folder? I don't know what @jamesmontemagno did to get it working. Unfortunately his update is not reflected in https://github.com/xamarin/Essentials/blob/master/Xamarin.Essentials/Xamarin.Essentials.csproj yet. |
You need to have the Project element look like this: {
"sdk": {
"version": "3.0.100-preview"
},
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "2.0.29"
}
} MSBuild will download the SDK from NuGet with either of those syntax options. |
That's what I did. I already pasted parts of my csproj file above. Here is just the first line again:
I never had a global.json file. |
You can look at what I have done here: xamarin/Essentials#813 |
I did the same as James. However, Xamarin.Essentials does not target WPF and my problems are with WPF. Here is a repro project. It uses my project structure, but with almost no content. Every platform has one class which uses a platform specific view. Repro.MSBuildSdkExtras.sln/.csproj uses MSBuild.Sdk.Extras 2.0.29 When I build the old version in VS2017, then it succeeds.
So it seems like the new MSBuild.Sdk.Extras does not include all references which version 1.5.4 included. I also see that in the solution explorer dependencies now. How can I add these? When I do Add Reference, I only see the target .NET Standard 1.0. |
I could add the missing references manually in the project file: <ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) ">
+ <Reference Include="System.Xaml">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="WindowsBase" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
<PackageReference Include="Xamarin.Forms.Platform.WPF" Version="4.0.0.425677" />
<Compile Include="WPF\**\*.cs" />
</ItemGroup> With these changes, version 2.0.29 also works for me. However this was not required with 1.5.4. Whether this was a bug in the old or the current version lies in the eye of the beholder. |
I found that file in C:\Users\micha.nuget\packages\msbuild.sdk.extras\2.0.29\Build\Platforms, but it doesn't seem like it will be run during build. I already attached my repro project above. Here is the binlog. |
I changed several projects to use one multi-targeting project last year. Back then I used MSBuild.Sdk.Extras 1.5.4 in VS2017 and it worked like a charm.
But now I want to use VS2019 and I ran into several different issues.
My problems with VS2019 are described in dotnet/project-system#4889.
But it looks more like this package is the problem.
I already read https://github.com/onovotny/MSBuildSdkExtras#migrate-from-the-old-way-vs-pre-156, but I need to compile that project for many different platforms including Xamarin.Mac20, uap10.0.16299 and net461. The former only works on Mac and the two others only on Windows.
Your migration description indicates, that I have to stay with the PackageReference when I need it in VS4Mac.
I did try to update to 2.0.24 on Windows using
but then I got:
and
I don't have a global.json, that's why I added the version in the Sdk.
I also tried to update only to the very next version after 1.5.4;1.6.19-preview, but then VS2017 seems to have problems finding the correct framework.
It tries to compile a class which is only for WPF in the project MR.Gestures (MonoAndroid81)
But when I open that file, the dropdown for the platform is correct.
Here are the relevant parts of my csproj file:
The first TargetFrameworks line is just for testing now. I actually want to use the lines which are now commented out.
The whole file is in dotnet/project-system#4889
The text was updated successfully, but these errors were encountered: