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

[dotnet] Add support for 'dotnet pack'. Fixes #12631. #12900

Merged
merged 2 commits into from
Oct 4, 2021

Conversation

rolfbjarne
Copy link
Member

Add support for 'dotnet pack', by:

  1. Add a workaround for the fact that as soon as a project has a
    'NativeReference' item, .NET's MSBuild logic wants to include a
    'Native.$(AssemblyName).manifest' file in the NuGet. This obviously breaks,
    because we don't create such a file, so we work around it by removing the
    file in question from the corresponding item groups.

  2. Add any binding resource packages to the NuGet.

  3. Add tests.

Fixes #12631.

Add support for 'dotnet pack', by:

1. Add a workaround for the fact that as soon as a project has a
   'NativeReference' item, .NET's MSBuild logic wants to include a
   'Native.$(AssemblyName).manifest' file in the NuGet. This obviously breaks,
   because we don't create such a file, so we work around it by removing the
   file in question from the corresponding item groups.

2. Add any binding resource packages to the NuGet.

3. Add tests.

Fixes dotnet#12631.
$(OutputPath) can be an absolute path, in which case prepending the current directory
is wrong.

The current directory is the project directory, so by just removing $(ProjectDir)
from the path, the existing logic should work both when $(OutputPath) is relative
and when it's absolute.
@rolfbjarne rolfbjarne added not-notes-worthy Ignore for release notes run-dotnet-tests Run all the .NET tests labels Oct 1, 2021
@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (only version changes)

GitHub pages

Results can be found in the following github pages (it might take some time to publish):

Test results

2 tests failed, 195 tests passed.

Failed tests

  • monotouch-test/Mac Catalyst [dotnet]/Debug [dotnet]: Failed (Tests run: 2659 Passed: 2492 Inconclusive: 35 Failed: 2 Ignored: 165)
  • xammac tests/Mac Modern/Release: Failed (Test run failed.
    Tests run: 2495 Passed: 2402 Inconclusive: 10 Failed: 1 Ignored: 92)

Pipeline on Agent XAMBOT-1101.BigSur'
Merge 36c1005 into 9d1b569


namespace Xamarin.Utils {
public static class ApplePlatformExtensionsWithVersions {
public static string ToFrameworkWithDefaultVersion (this ApplePlatform @this)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little confusing to me...
From quick googling, it looks like the '@this' allows you to use '@this' as a variable name, but why do we want to do this here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an extension method, which allows you to write methods that kind of work like instance methods. In instance methods you use this to refer to the instance, and while you can't use this in an extension method, you can use @this(the @ sign makes it so that this isn't a keyword, just a normal variable name), and that makes it look more like an instance method. In other words: it's just a convention to make extension methods look more like instance methods.

@rolfbjarne
Copy link
Member Author

Test failures are unrelated:

@rolfbjarne rolfbjarne merged commit 62bdd68 into dotnet:main Oct 4, 2021
@rolfbjarne rolfbjarne deleted the dotnet-pack branch October 4, 2021 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-notes-worthy Ignore for release notes run-dotnet-tests Run all the .NET tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't generate nuget package from .NET 6 MacOS bindings project
6 participants