Skip to content
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

[build] consider $NUGET_PACKAGES for $(XAPackagesDir) #8136

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

jonathanpeppers
Copy link
Member

Context: https://learn.microsoft.com/nuget/reference/cli-reference/cli-ref-environment-variables

I recently paved my Windows PC and set %NUGET_PACKAGES% to a Dev Drive at:

D:\.nuget\packages

This caused Xamarin.Android's build to fail with:

Mono.Android.targets(220,5): error : CompatApi command: dotnet "C:\Users\jonat\.nuget\packages/microsoft.dotnet.apicompat/7.0.0-beta.22103.1/tools/net472/..\netcoreapp3.1\Microsoft.DotNet.ApiCompat.dll" "D:\src\xamarin-android\tests\api-compatibility\reference\net8.0\Mono.Android.dll" -i "D:\src\xamarin-android\bin\Debug\lib\xamarin.android\xbuild-frameworks\Microsoft.Android\33" --allow-default-interface-methods --baseline "D:\src\xamarin-android\tests\api-compatibility\acceptable-breakages-vReference-net8.0.txt" --validate-baseline --exclude-attributes "D:\src\xamarin-android\tests\api-compatibility\api-compat-exclude-attributes.txt"
error : CheckApiCompatibility found nonacceptable Api breakages for ApiLevel: v13.0.
error : Could not execute because the specified command or file was not found.
error : Possible reasons for this include:
error : * You misspelled a built-in dotnet command.
error : * You intended to execute a .NET program, but dotnet-C:\Users\jonat\.nuget\packages/microsoft.dotnet.apicompat/7.0.0-beta.22103.1/tools/net472/..\netcoreapp3.1\Microsoft.DotNet.ApiCompat.dll does not exist.
error : * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

I added a check for $(NUGET_PACKAGES).

This may not 100% match NuGet behavior, but solves the issue.

Context: https://learn.microsoft.com/nuget/reference/cli-reference/cli-ref-environment-variables

I recently paved my Windows PC and set `%NUGET_PACKAGES%` to a Dev Drive at:

    D:\.nuget\packages

This caused Xamarin.Android's build to fail with:

    Mono.Android.targets(220,5): error : CompatApi command: dotnet "C:\Users\jonat\.nuget\packages/microsoft.dotnet.apicompat/7.0.0-beta.22103.1/tools/net472/..\netcoreapp3.1\Microsoft.DotNet.ApiCompat.dll" "D:\src\xamarin-android\tests\api-compatibility\reference\net8.0\Mono.Android.dll" -i "D:\src\xamarin-android\bin\Debug\lib\xamarin.android\xbuild-frameworks\Microsoft.Android\33" --allow-default-interface-methods --baseline "D:\src\xamarin-android\tests\api-compatibility\acceptable-breakages-vReference-net8.0.txt" --validate-baseline --exclude-attributes "D:\src\xamarin-android\tests\api-compatibility\api-compat-exclude-attributes.txt"
    error : CheckApiCompatibility found nonacceptable Api breakages for ApiLevel: v13.0.
    error : Could not execute because the specified command or file was not found.
    error : Possible reasons for this include:
    error : * You misspelled a built-in dotnet command.
    error : * You intended to execute a .NET program, but dotnet-C:\Users\jonat\.nuget\packages/microsoft.dotnet.apicompat/7.0.0-beta.22103.1/tools/net472/..\netcoreapp3.1\Microsoft.DotNet.ApiCompat.dll does not exist.
    error : * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

I added a check for `$(NUGET_PACKAGES)`.

This may not 100% match NuGet behavior, but solves the issue.
@jonathanpeppers
Copy link
Member Author

One test phase timed out, but I don't think we need to rerun it.

@jonathanpeppers jonathanpeppers merged commit 66a0389 into dotnet:main Jun 20, 2023
@jonathanpeppers jonathanpeppers deleted the NUGET_PACKAGES branch June 20, 2023 20:38
grendello added a commit to grendello/xamarin-android that referenced this pull request Jun 21, 2023
* main:
  [One .NET] fix 'dotnet publish' with no arguments (dotnet#8137)
  [build] consider `$NUGET_PACKAGES` for `$(XAPackagesDir)` (dotnet#8136)
  Bump external/xamarin-android-tools from `44885bc` to `3cee10b` (dotnet#8121)
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2024
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.

3 participants