dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.93k stars 531 forks source link

Code Shrinker Proguard confusion and problem between VS versions #3161

Closed EmilAlipiev closed 4 years ago

EmilAlipiev commented 5 years ago

You have introduced 2 new settings for android as below. These settings are only available on VS 2019 windows.

image

So you removed "Enable proguard" boolean option. I understand that. but here is the problem I am using VS2019 Mac parallel with VS2019 Windows. Those 2 options arent available on Mac version. There is still old option Enable proguard like VS2017. And this option has no effect. it just doesnt work if you enable it, you can see that it wont add any settings in Android.proj.cs If i push my changes into remote git from VS2017 with "enable proguard" and check out those in VS 2019 mac, VS makes automatic changes and removes all my settings. see the stackoverflow topic here.

image

I have tested all those by creating a new project and problem can be reproducible. I dont know if it is xamarin team or visual studio team but i would like this problem to be fixed.

JonDouglas commented 5 years ago

Although these new options haven't made the Visual Studio for Mac version, they are coming. They are currently in Visual Studio for Mac 8.1, which is in preview today.

We highly recommend that using Visual Studio 2019 on Windows and Mac, that you match the version numbers as closely as possible such as 16.1 -> 8.1 respectfully.

Please note that these properties that Visual Studio 2019 adds, should be compatible with Visual Studio for Mac 8.0+(if not earlier).

In your screenshot with the following properties:

AndroidLinkSkip , EnableMultidex and enableProguard are removed.

The only thing that should potentially be changed is EnableProguard, but we still support that in the SDK.

I'm not exactly sure why Visual Studio for Mac is attempting to remove any of these properties. This is a bug in Visual Studio for Mac from my eyes. I would highly recommend reporting an issue via Help -> Report a Problem within Visual Studio.

Before closing out this GitHub issue as from the current context, I'd like @jonathanpeppers or @dellis1972 to double check and make sure we aren't doing anything to remove these other properties.

But for the time being, please report a problem in Visual Studio so the Visual Studio for Mac team is aware! Feel free to send us a link and we'll make sure we can address this sooner than later.

dellis1972 commented 5 years ago

Those properties are still available and should work if added to the csproj manually.

EmilAlipiev commented 5 years ago

@JonDouglas I have followed your advise with vs Mac preview but I cannot get along with it. there is problem with .net core 2.1 it seems like. I am getting error as Error: NET Core 2.1 SDK version 2.1.505 is not compatible with this version of Visual Studio for Mac. Install the latest update to the .NET Core 2.1 SDK by visiting https://aka.ms/vs/mac/install-netcore21.