Closed mderriey closed 1 year ago
@jchannon when you have a moment, could you please take a look at this, as well as #302 which does the same thing but a different way? Cheers.
Away at the moment. Will take a look next week:)
On Fri, 21 Oct 2022 at 10:22, Mickaël Derriey @.***> wrote:
@jchannon https://github.com/jchannon when you have a moment, could you please take a look at this, as well as #302 https://github.com/CarterCommunity/Carter/pull/302 which does the same thing but a different way? Cheers.
— Reply to this email directly, view it on GitHub https://github.com/CarterCommunity/Carter/pull/303#issuecomment-1286693575, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAZVJXX7MBV4ZKRR4F45NTWEJODRANCNFSM6AAAAAARK6PILM . You are receiving this because you were mentioned.Message ID: @.***>
Friendly bump @jchannon. As always, this is just a reminder in case you forgot about this, but please have a look whenever you want.
Sorry just realised I didn't start a review and submitted comments individually
Looks good though! Do you want to close #302 ?
Related to #298. Discussed in https://github.com/CarterCommunity/Carter/pull/299#issuecomment-1257956828
Context
Please see the "Goal" and "Considerations" sections of #302. This PR achieves the same result but with a different method, which is explained below.
Detailed walkthrough
I kept thinking at the solution used in #302, which, while it works, brings a lot of changes and cognitive load:
csproj
fileOverall, I found it a bit too complicated.
I thought about how we could keep the process closer to what it is currently, and came to the conclusion that executing our logic (overriding the MinVer version for PRs, and updating the
csproj
file) within MSBuild would be the easiest way to do this.Updating the
csproj
fileMSBuild allows declaring tasks with C# code that is then compiled by Roslyn. C# code in
.targets
file is yuck, but what we're doing here is simple.The steps are as follows:
targets
file from the Template project: https://github.com/CarterCommunity/Carter/pull/303/files#diff-800f45f46df5585e5ef019f729b3fd356ae505f2e3cf7870866074ba39244967R36<ProjectReference>
andPackageReference
: https://github.com/CarterCommunity/Carter/pull/303/files#diff-b9d07d74605b6299754f85f8bb50c521c8c6fe2ce642ede2df1dca75faa4a019R19-R43Result
When PRs get merged or the repo is tagged, we'll now publish both the
Carter
and theCarterTemplate
packages at the same time.For example, if the repo is tagged with
7.0.0
:Carter
package version 7.0.0 to NuGet, andCarterTemplate
package version 7.0.0; when we scaffold the project using this template, it will referenceCarter
version 7.0.0.