Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Conversation

@jonathanpeppers
Copy link
Member

Usage of Xamarin.Legacy.Sdk on xamarin-android's CI fails with:

error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project.

Reviewing the build logs, Xamarin.Android.CSharp.targets fails to be
imported at all due to:

_LegacyExtensionsPath = C:\Program Files (x86)\Microsoft Visual Studio\2019\EnterpriseMSBuild

It appears that if either %VSINSTALLDIR% or $(VsInstallRoot) were
missing a trailing slash, then $(_LegacyExtensionsPath) would be
incorrect.

First I added a new samples/tests folder, to start throwing in
one-off projects as pseudo-unit tests. Or maybe integration tests is a
better term? dotnet build samples.sln should be the equivalent of
running tests in this repo.

Next, I moved the $(VsInstallRoot) logic to its own
Xamarin.VsInstallRoot.targets file to be shared between iOS and
Android.

Lastly, I added the appropriate EnsureTrailingSlash() call:

https://docs.microsoft.com/visualstudio/msbuild/property-functions#msbuild-ensuretrailingslash

Usage of Xamarin.Legacy.Sdk on xamarin-android's CI fails with:

    error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project.

Reviewing the build logs, `Xamarin.Android.CSharp.targets` fails to be
imported at all due to:

    _LegacyExtensionsPath = C:\Program Files (x86)\Microsoft Visual Studio\2019\EnterpriseMSBuild

It appears that if either `%VSINSTALLDIR%` or `$(VsInstallRoot)` were
missing a trailing slash, then `$(_LegacyExtensionsPath)` would be
incorrect.

First I added a new `samples/tests` folder, to start throwing in
one-off projects as pseudo-unit tests. Or maybe integration tests is a
better term? `dotnet build samples.sln` should be the equivalent of
running tests in this repo.

Next, I moved the `$(VsInstallRoot)` logic to its own
`Xamarin.VsInstallRoot.targets` file to be shared between iOS and
Android.

Lastly, I added the appropriate `EnsureTrailingSlash()` call:

https://docs.microsoft.com/visualstudio/msbuild/property-functions#msbuild-ensuretrailingslash
@jonathanpeppers
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jonathanpeppers jonathanpeppers merged commit 5d9facb into main Feb 3, 2021
@jonathanpeppers jonathanpeppers deleted the vsinstallroot-ensuretrailingslash branch February 3, 2021 21:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants