-
Notifications
You must be signed in to change notification settings - Fork 564
[Xamarin.ProjectTools] fix toggling XamarinProject.IsRelease #5571
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
[Xamarin.ProjectTools] fix toggling XamarinProject.IsRelease #5571
Conversation
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4422361&view=ms.vss-test-web.build-test-results-tab&runId=18547936&resultId=100086&paneView=debug We had an MSBuild test failing under .NET 6: MSBuildDeviceIntegration On Device - macOS - One .NET > SwitchConfigurationsShouldRedeploy fastdev directory should NOT exist for Release builds. Expected string length 0 but was 4970. Strings differ at index 0. Expected: <string.Empty> But was: "Java.Interop.dll\nMicrosoft.CSharp.dll\nMicrosoft.VisualBasic.C..." This was because a supposed `Release` build was skipping the `_Upload` target completely: Skipping target "_Upload" because all output files are up-to-date with respect to the input files. Input files: bin\Debug\UnnamedProject.UnnamedProject-Signed.apk... It appears that toggling `XamarinProject.IsRelease` is not triggering the correct files to save when the tests run under .NET 6. Under "legacy" Xamarin.Android, the tests simply put this at the top of the `.csproj`: <Configuration>Debug</Configuration> ... <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> This won't work in short-form MSBuild projects, because the `.csproj` is effectively: <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" /> ... <Configuration>Debug</Configuration> ... <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" /> For things to work properly, we need `$(Configuration)` to be set *before* `Microsoft.NET.Sdk/Sdk.props`. So we put `$(Configuration)` in a `Directory.Build.props` to solve this ordering problem. Unfortunately, we were not calling `Touch()` on this file when `XamarinProject.IsRelease` changes. After making this change, `SwitchConfigurationsShouldRedeploy` passes.
|
Failing test is The logcat This fails on both Legacy and One. net. So I assume its not related. So I will merge this one |
|
To keep the link here for future reference. This may help in debugging dlopen behavior on Android O and newer: https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#enable-logging-of-dlopen_dlsym-and-library-loading-errors-for-apps-available-in-android-o |
…5571) Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4422361&view=ms.vss-test-web.build-test-results-tab&runId=18547936&resultId=100086&paneView=debug We had an MSBuild test failing under .NET 6: MSBuildDeviceIntegration On Device - macOS - One .NET > SwitchConfigurationsShouldRedeploy fastdev directory should NOT exist for Release builds. Expected string length 0 but was 4970. Strings differ at index 0. Expected: <string.Empty> But was: "Java.Interop.dll\nMicrosoft.CSharp.dll\nMicrosoft.VisualBasic.C..." This was because a supposed `Release` build was skipping the `_Upload` target completely: Skipping target "_Upload" because all output files are up-to-date with respect to the input files. Input files: bin\Debug\UnnamedProject.UnnamedProject-Signed.apk... It appears that toggling `XamarinProject.IsRelease` is not triggering the correct files to save when the tests run under .NET 6. Under "legacy" Xamarin.Android, the tests simply put this at the top of the `.csproj`: <Configuration>Debug</Configuration> ... <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> This won't work in short-form MSBuild projects, because the `.csproj` is effectively: <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" /> ... <Configuration>Debug</Configuration> ... <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" /> For things to work properly, we need `$(Configuration)` to be set *before* `Microsoft.NET.Sdk/Sdk.props`. So we put `$(Configuration)` in a `Directory.Build.props` to solve this ordering problem. Unfortunately, we were not calling `Touch()` on this file when `XamarinProject.IsRelease` changes. After making this change, `SwitchConfigurationsShouldRedeploy` passes.
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4422361&view=ms.vss-test-web.build-test-results-tab&runId=18547936&resultId=100086&paneView=debug We had an MSBuild test failing under .NET 6: MSBuildDeviceIntegration On Device - macOS - One .NET > SwitchConfigurationsShouldRedeploy fastdev directory should NOT exist for Release builds. Expected string length 0 but was 4970. Strings differ at index 0. Expected: <string.Empty> But was: "Java.Interop.dll\nMicrosoft.CSharp.dll\nMicrosoft.VisualBasic.C..." This was because a supposed `Release` build was skipping the `_Upload` target completely: Skipping target "_Upload" because all output files are up-to-date with respect to the input files. Input files: bin\Debug\UnnamedProject.UnnamedProject-Signed.apk... It appears that toggling `XamarinProject.IsRelease` is not triggering the correct files to save when the tests run under .NET 6. Under "legacy" Xamarin.Android, the tests simply put this at the top of the `.csproj`: <Configuration>Debug</Configuration> ... <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> This won't work in short-form MSBuild projects, because the `.csproj` is effectively: <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" /> ... <Configuration>Debug</Configuration> ... <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" /> For things to work properly, we need `$(Configuration)` to be set *before* `Microsoft.NET.Sdk/Sdk.props`. So we put `$(Configuration)` in a `Directory.Build.props` to solve this ordering problem. Unfortunately, we were not calling `Touch()` on this file when `XamarinProject.IsRelease` changes. After making this change, `SwitchConfigurationsShouldRedeploy` passes.
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4422361&view=ms.vss-test-web.build-test-results-tab&runId=18547936&resultId=100086&paneView=debug
We had an MSBuild test failing under .NET 6:
This was because a supposed
Releasebuild was skipping the_Uploadtarget completely:
It appears that toggling
XamarinProject.IsReleaseis not triggeringthe correct files to save when the tests run under .NET 6.
Under "legacy" Xamarin.Android, the tests simply put this at the top
of the
.csproj:This won't work in short-form MSBuild projects, because the
.csprojis effectively:
For things to work properly, we need
$(Configuration)to be setbefore
Microsoft.NET.Sdk/Sdk.props.So we put
$(Configuration)in aDirectory.Build.propsto solvethis ordering problem. Unfortunately, we were not calling
Touch()onthis file when
XamarinProject.IsReleasechanges.After making this change,
SwitchConfigurationsShouldRedeploypasses.