This repository has been archived by the owner on Nov 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 520
Handling Multiple TargetFrameworks through BuildProperties #567
Merged
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
8dbb2a5
adding a sample project with plural form of TargetFrameworks for debu…
tebeco 333e9cf
add --framework argument to RunCommand
tebeco d4cecb9
Pass down "framework" as a BuildProperty if not already defined in th…
tebeco 2574622
Do no throw anymore when multiple TargetFrameworks are found, if one …
tebeco b0ff307
replicating Signature change on code base (that does not look like a …
tebeco 48f42c6
adding comment to be explicit on what this does
tebeco 889c15d
Check that the specified BuildProperties["TargetFramework"] is on of …
tebeco 6ccf418
add launchSettings for debug
tebeco e5b00f5
Create a BuildCommandArguments for the BuildCommand / add a "framewor…
tebeco 96ba02d
add "-f {framework}" to dotnet publish if a TargetFramework BuildProp…
tebeco a71d7b2
Create a GenerateCommandArguments for the GenerateCommand / add a "fr…
tebeco f6d6ad2
Create a PushCommandArguments for the PushCommand / add a "framework"…
tebeco 7a370c1
Create a UndeployCommandArguments for the UndeployCommand / add a "fr…
tebeco 365c95d
Create a DeployCommandArguments for the DeployCommand / add a "framew…
tebeco 67c2eaa
framework is now an optional parameter defaulted to null
tebeco 77f04bb
Change sample to use LTS only
tebeco 29bf9b7
Make "framework" argument nullable / optional / defaulted to null
tebeco e4c0ba6
remove "Force" from "PushCommand" and "PushCommandArguments" if it's …
tebeco 3d7ff54
re-use the equivalent message than "dotnet run" on a project with mul…
tebeco 2fac5cd
Create a StandardOptions for Framework
tebeco 1538fb7
Remove unused StandardOption.Force and add StandardOption.CreateForce…
tebeco 1e5b2d7
Use StandardOptions.Framework in various commands
tebeco a082ff7
use StandardOptions.Force ni various commands
tebeco 2d197c9
Create a new InitCommandArguments and re-use the same OutputContext l…
tebeco edaa741
prefer type alias (String.IsNullOrEmpty => string.IsNullOrEmpty), not…
tebeco e9f17b1
Adding assets for E2E about multi-targetframeworks that returns the c…
tebeco e81d15b
Adding test for "tye run" with either buildProperties in the yaml or …
tebeco 9a9e9aa
Add test and testasset project for both TargetFrameworks and TargetFr…
tebeco f91deeb
Always overwrite the TargetFramework if one is specified from the CLI…
tebeco a8e6c8a
Test the ability to override TargetFramework from CLI even if define …
tebeco 25f649b
Consistency over ApplicationFactory.CreateAsync in all E2E tests
tebeco 18e1ec8
rename testasset project to multi-targetframeworks to match generated…
tebeco 6efc117
Add E2E for tye build when project uses multi-targetframeworks
tebeco b1d4977
Adding test directly for ApplicationFactory to check that it override…
tebeco aceeba0
Adding test to make sure it still throw if there's no explicit Target…
tebeco d5a45e6
Adding test for ApplicationFactory.CreateAsync with a framework if no…
tebeco 0773d99
make cli arguments class private
tebeco 1761cfe
review: remove extra line
tebeco 02f2565
review: remove 'framework' notion from Undeploy
tebeco 56ab74e
Fix project evaluation of multi-targetd projects
031b646
Merge pull request #1 from dotnet/johluo/multi-tfm-fixup
tebeco 1fff983
Fixup a few more tests
e632b84
Comment updates
e806436
Ensure TFM is only applied for multi-targeting projects
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
rename testasset project to multi-targetframeworks to match generated…
… Dockerfile
- Loading branch information
commit 18e1ec831b5b8b9330f21163562eeb097ebda719
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ssets/projects/multi-targetframeworks-and-targetframework-too/tye-no-buildproperties.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# tye application configuration file | ||
# read all about it at https://github.com/dotnet/tye | ||
name: multi-targetframeworks | ||
name: multi-targetframeworks-and-targetframework-too | ||
services: | ||
- name: backend | ||
project: backend/backend.csproj | ||
- name: multi-targetframeworks-and-targetframework-too | ||
project: multi-targetframeworks-and-targetframework-too/multi-targetframeworks-and-targetframework-too.csproj | ||
bindings: | ||
- port: 7000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
projects shouldn't specify both
TargetFramework
andTargetFrameworks
at the same time. I don't think testing such a scenario is needed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand it's weird to read, this is how
MsBuild
anddotnet
works todaySo I tried to cover existing "possible scenario"
This is also how
dotnet/tye
works intye.yaml
when usingbuildProperties
forTargetFramework
if the csproj usesTargetFrameworks
What should I do ? Do you want me to remove this sample anyway ?
eg:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So yes and no, for example take a look at the docs https://docs.microsoft.com/en-us/dotnet/standard/frameworks#how-to-specify-target-frameworks. The idea is that you can target multiple frameworks in your project by using
TargetFrameworks
. This is especially important for libraries which might need to maintain compatibility with older frameworks but also take advantage of new APIs but can also be done for apps like you've demonstrated. However, if you do multi-target apps you are essentially building for both TFMs and you will need to specify a specific target framework to run. The mechanism to do this is to specify a singleTargetFramework
, for example via CLI. However, it doesn't make sense to do so in a csproj file since if you are specifying a singleTargetFramework
at build time, why even bother defining multiple frameworks in the first place?Unless there's a compelling reason to keep this sample, I would remove it and the tests associated with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, as I tried to read your comments here, I know realize that my answer is split in two with
#567 (comment)
Also this is also practical aside library, especially when you are migrating a webapi or a CLI from
netcoreapp3.1
tonet5.0
for example. It allows you to have both code build / test / E2E and decide within the CI or deployement which artifact you will ship to production (or even both for canary or blue/green)Of course the
--framework
is, defacto, mandatory for such use, but it's not limited to library. I did not tried to overthink it to be fair, I just tried to make sure the behavior oftye
was somehow the same asdotnet
.I'm fine with keeping or removing it, but I guess this will depends on the other comment bellow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said previously,
I'm agreeing with you that there is valid use of multi-targeted apps. The comment about libraries is more of a side note. My main point is that it doesn't make sense to specify both TargetFramework and TargetFrameworks in an app. You either specify one or the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to circle back, the
TargetFramework
property should be removed here.