Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

kzu
Copy link
Contributor

@kzu kzu commented Jul 19, 2019

Given that AssemblyMetadataAttribute is such a common assembly-level attribute, this adds support
for specifying it directly via simple items, such as:

    <AssemblyMetadata Include="Foo" Value="Bar" />
    <AssemblyMetadata Include="Bar" Value="Baz" />

This also avoids having to learn the _Parameter1 and _Parameter2 syntax in AssemblyAttribute elements,
and is more similar to the way other higher-level properties like AssemblyTitle or Product are also
turned into assembly attributes.

Partially fixes #3166

The feature can be disabled by setting $(GenerateAssemblyMetadataAttributes) to false.

@peterhuene peterhuene added this to the 3.0.1xx milestone Jul 19, 2019
@peterhuene peterhuene requested a review from a team July 19, 2019 17:48
@peterhuene
Copy link
Contributor

Hi @kzu. This looks good.

Could you add some test coverage to this PR?

@kzu
Copy link
Contributor Author

kzu commented Jul 25, 2019

Could you point me to the place where existing tests for the other AssemblyAttribute items are so I can add to those? Thanks!

@peterhuene
Copy link
Contributor

@kzu here is a test that is setting the individual properties that cause additional AssemblyAttribute items to be defined.

We should probably add a test to this file to cover setting AssemblyMetadata items in the test project file and reflecting on the output assembly to ensure the attributes were set.

…ributes

Given that `AssemblyMetadataAttribute` is such a common assembly-level attribute, this adds support
for specifying it directly via simple items, such as:

```
    <AssemblyMetadata Include="Foo" Value="Bar" />
    <AssemblyMetadata Include="Bar" Value="Baz" />
```

This also avoids having to learn the `_Parameter1` and `_Parameter2` syntax in `AssemblyAttribute` elements,
and is more similar to the way other higher-level properties like `AssemblyTitle` or `Product` are also
turned into assembly attributes.

Partially fixes dotnet#3166

The feature can be disabled by setting `$(GenerateAssemblyMetadataAttributes)` to `false`.
@kzu
Copy link
Contributor Author

kzu commented Sep 15, 2019

@peterhuene added two tests to verify both new scenarios supported.

Thanks!

kzu added a commit to kzu/visualstudio-docs that referenced this pull request Sep 15, 2019
@kzu
Copy link
Contributor Author

kzu commented Sep 15, 2019

Added the corresponding docs PR too.

@nguerrera nguerrera modified the milestones: 3.0.1xx, 5.0.1xx Oct 28, 2019
@kzu
Copy link
Contributor Author

kzu commented Jan 14, 2020

All green now :shipit:

@dsplaisted
Copy link
Member

@sfoslund Would you like to review this PR?

Copy link
Member

@sfoslund sfoslund left a comment

Choose a reason for hiding this comment

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

Looks good to me!

new XAttribute("Value", "MetadataValue"))));
});

new RestoreCommand(Log, testAsset.TestRoot).Execute().Should().Pass();
Copy link
Member

Choose a reason for hiding this comment

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

nit: I believe it's not usually necessary to explicitly restore before building anymore, is that correct @dsplaisted

buildCommand.Execute().Should().Pass();

var assemblyPath = Path.Combine(buildCommand.GetOutputDirectory("netstandard2.0").FullName, "HelloWorld.dll");
var info = AssemblyInfo.Get(assemblyPath);
Copy link
Member

Choose a reason for hiding this comment

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

nit: variable never used

@dsplaisted dsplaisted merged commit 94d4bc3 into dotnet:master Jan 16, 2020
@kzu kzu deleted the patch-2 branch January 18, 2020 23:30
dsplaisted pushed a commit to dsplaisted/sdk that referenced this pull request Feb 19, 2020
* Update dependencies from https://github.com/aspnet/AspNetCore build 20191102.3

- Microsoft.AspNetCore.DeveloperCertificates.XPlat - 5.0.0-alpha1.19552.3

* Update dependencies from https://github.com/aspnet/AspNetCore build 20191103.1

- Microsoft.AspNetCore.DeveloperCertificates.XPlat - 5.0.0-alpha1.19553.1

* Update dependencies from https://github.com/aspnet/AspNetCore build 20191104.1

- Microsoft.AspNetCore.DeveloperCertificates.XPlat - 5.0.0-alpha1.19554.1
dsplaisted pushed a commit to dsplaisted/sdk that referenced this pull request Feb 19, 2020
* master: (27 commits)
  Add DOTNET_ROOT to tests and fix dogfood script
  Remove duplicated key
  Installation script update (dotnet#13030)
  Use scanelf over ldconfig on musl-libc distros (dotnet#12642)
  Allow list more properties (dotnet#3459)
  Update dependencies from https://github.com/mono/linker build 20191106.1 (dotnet#3476)
  [master] Update dependencies from aspnet/websdk (dotnet#3466)
  Update dependencies from https://github.com/aspnet/AspNetCore build 20191105.3 (dotnet#3473)
  Update dependencies from https://github.com/dotnet/windowsdesktop build 20191105.1 (dotnet#3469)
  Update dependencies from https://github.com/dotnet/arcade build 20191104.3 (dotnet#3465)
  Update dependencies from https://github.com/aspnet/websdk build 20191103.2 (dotnet#3454)
  [master] Update dependencies from dotnet/arcade (dotnet#3416)
  Update dependencies from https://github.com/aspnet/AspNetCore build 20191104.3 (dotnet#3458)
  Update dependencies from https://github.com/dotnet/templating build 20191104.1 (dotnet#3457)
  [master] Update dependencies from Microsoft/msbuild (dotnet#3423)
  [master] Update dependencies from aspnet/AspNetCore (dotnet#3440)
  Update dependencies from https://github.com/dotnet/windowsdesktop build 20191104.2 (dotnet#3455)
  [master] Update dependencies from dotnet/core-setup (dotnet#3445)
  Update dependencies from https://github.com/dotnet/windowsdesktop build 20191102.6 (dotnet#3446)
  Update dependencies from https://github.com/aspnet/websdk build 20191102.2 (#3444)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GenerateAssemblyInfo support for InternalsVisibleToAttribute and AssemblyMetadataAttribute

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.