Add support for @(AssemblyMetadata) items that turn into assembly attributes#3440
Conversation
|
Hi @kzu. This looks good. Could you add some test coverage to this PR? |
|
Could you point me to the place where existing tests for the other |
|
@kzu here is a test that is setting the individual properties that cause additional We should probably add a test to this file to cover setting |
…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 #3166
The feature can be disabled by setting `$(GenerateAssemblyMetadataAttributes)` to `false`.
|
@peterhuene added two tests to verify both new scenarios supported. Thanks! |
Documents the new behavior in dotnet/sdk#3440
|
Added the corresponding docs PR too. |
|
All green now |
|
@sfoslund Would you like to review this PR? |
| new XAttribute("Value", "MetadataValue")))); | ||
| }); | ||
|
|
||
| new RestoreCommand(Log, testAsset.TestRoot).Execute().Should().Pass(); |
There was a problem hiding this comment.
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); |
* 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
* 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) ...
Given that
AssemblyMetadataAttributeis such a common assembly-level attribute, this adds supportfor specifying it directly via simple items, such as:
This also avoids having to learn the
_Parameter1and_Parameter2syntax inAssemblyAttributeelements,and is more similar to the way other higher-level properties like
AssemblyTitleorProductare alsoturned into assembly attributes.
Partially fixes #3166
The feature can be disabled by setting
$(GenerateAssemblyMetadataAttributes)tofalse.