diff options
author | Rich Lander <rlander@microsoft.com> | 2020-08-22 01:01:10 +0300 |
---|---|---|
committer | Rich Lander <rlander@microsoft.com> | 2020-08-22 01:01:10 +0300 |
commit | 4b53ccd8fec57228fa4d1a8d2474a94ad80764fa (patch) | |
tree | 050f907f30a48be4d1c3705593f2d2747c741c89 /samples | |
parent | e457470a1b6ec21ce3131d50b0ee7eb4345cba45 (diff) |
Move sourcelink items/properties to D.b.p
Diffstat (limited to 'samples')
-rw-r--r-- | samples/Directory.build.props | 14 | ||||
-rw-r--r-- | samples/dotnet-runtimeinfo/dotnet-runtimeinfo.csproj | 6 | ||||
-rw-r--r-- | samples/dotnetsay/README.md | 14 | ||||
-rw-r--r-- | samples/dotnetsay/dotnetsay.csproj | 6 |
4 files changed, 25 insertions, 15 deletions
diff --git a/samples/Directory.build.props b/samples/Directory.build.props new file mode 100644 index 00000000..f8f2d473 --- /dev/null +++ b/samples/Directory.build.props @@ -0,0 +1,14 @@ +<Project> + + <PropertyGroup Condition="'$(ContinuousIntegrationBuild)'=='true'"> + <Configuration>release</Configuration> + <PublishRepositoryUrl>true</PublishRepositoryUrl> + <DebugType>embedded</DebugType> + <EmbedUntrackedSources>true</EmbedUntrackedSources> + </PropertyGroup> + + <ItemGroup Condition="'$(ContinuousIntegrationBuild)'=='true'"> + <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> + </ItemGroup> + +</Project> diff --git a/samples/dotnet-runtimeinfo/dotnet-runtimeinfo.csproj b/samples/dotnet-runtimeinfo/dotnet-runtimeinfo.csproj index 4fe68637..9add8bb2 100644 --- a/samples/dotnet-runtimeinfo/dotnet-runtimeinfo.csproj +++ b/samples/dotnet-runtimeinfo/dotnet-runtimeinfo.csproj @@ -10,16 +10,12 @@ <PackageLicenseExpression>MIT</PackageLicenseExpression> <Copyright>.NET Foundation</Copyright> <Authors>.NET Team</Authors> - <EmbedUntrackedSources>true</EmbedUntrackedSources> <PackAsTool>true</PackAsTool> </PropertyGroup> <!-- To pack correctly - dotnet pack -c release /p:ContinuousIntegrationBuild=true + dotnet pack /p:ContinuousIntegrationBuild=true --> - <ItemGroup Condition="'$(ContinuousIntegrationBuild)'=='true'"> - <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> - </ItemGroup> </Project> diff --git a/samples/dotnetsay/README.md b/samples/dotnetsay/README.md index 3397e095..f11d5a01 100644 --- a/samples/dotnetsay/README.md +++ b/samples/dotnetsay/README.md @@ -66,20 +66,24 @@ You can make tools debuggable with [sourcelink](https://github.com/dotnet/source <EmbedUntrackedSources>true</EmbedUntrackedSources> </PropertyGroup> -<ItemGroup Condition="'$(ContinuousIntegrationBuild)'=='true'"> +<ItemGroup> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> </ItemGroup> ``` -> Note: This example conditionalizes the `PackageReference` to the `ContinuousIntegrationBuild` property being set. There is no problem running SourceLink on every build, however, it will fail if it cannot find a `.git` directory. Given that behavior, it may be easier to use the approach shown above. +The [dotnetsay project](dotnetsay.csproj) doesn't add these properties or the `PackageReference` but relies on the same information in the [Directory.build.props](../Directory.build.props) in the parent directory. -Use [`ContinuousIntegrationBuild`](https://github.com/dotnet/sourcelink/blob/master/docs/README.md#continuousintegrationbuild) when producing official builds. The simplest way to do that is by packing with an additional property set. +> Note: The approach used in [Directory.build.props](../Directory.build.props) conditionalizes sourcelink properties and `PackageReference` to the `ContinuousIntegrationBuild` property being set. There is no problem running SourceLink on every build, however, it isn't necessary. + +Use [`ContinuousIntegrationBuild`](https://github.com/dotnet/sourcelink/blob/master/docs/README.md#continuousintegrationbuild) when producing official builds. If you don't, the sourcelink information will be wrong. The simplest way to do that is by packing with an additional property set, as follows. ```console -dotnet pack -c Release -o nupkg /p:ContinuousIntegrationBuild=true +dotnet pack /p:ContinuousIntegrationBuild=true ``` -Make sure to build official packages from repositories with stable commit hashes. If you build from a branch whose commits are later [squashed](https://help.github.com/articles/about-pull-request-merges/), then the commit hashs will not be found and sourcelink will not work correctly. +Make sure to build official packages from branches/repositories with stable commit hashes. If you build from a branch whose commits are later [squashed](https://help.github.com/articles/about-pull-request-merges/), then the commit hashs will not be found and sourcelink will not work correctly. + +SourceLink will fail if it cannot find a `.git` directory. This can happen if you build projects in containers at solution root and not repo root for example. There are solutions to that problem described at the [sourcelink repo](https://github.com/dotnet/sourcelink). ## Debug Tools with Visual Studio diff --git a/samples/dotnetsay/dotnetsay.csproj b/samples/dotnetsay/dotnetsay.csproj index 923d7cbe..49dd9a8b 100644 --- a/samples/dotnetsay/dotnetsay.csproj +++ b/samples/dotnetsay/dotnetsay.csproj @@ -10,16 +10,12 @@ <PackageLicenseExpression>MIT</PackageLicenseExpression> <Copyright>.NET Foundation</Copyright> <Authors>.NET Team</Authors> - <EmbedUntrackedSources>true</EmbedUntrackedSources> <PackAsTool>true</PackAsTool> </PropertyGroup> <!-- To pack correctly - dotnet pack -c release /p:ContinuousIntegrationBuild=true + dotnet pack /p:ContinuousIntegrationBuild=true --> - <ItemGroup Condition="'$(ContinuousIntegrationBuild)'=='true'"> - <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> - </ItemGroup> </Project> |