-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a build error if building on an unsupported SDK #135
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
<Project> | ||
<Target Name="_ContainerVerifySDKVersion" | ||
Condition="'$(WebPublishMethod)' == 'Container' or '$(PublishProfile)' == 'DefaultContainer'" | ||
BeforeTargets="AfterPublish"> | ||
<!-- If the user has opted into container publishing via their own profile (WebPublishMethod = Container) or | ||
via the default Profile (PublishProfile = DefaultContainer), make sure they're on a supported SDK version. | ||
We do the explicit profile name check here because for preview6 for example the profile didn't exist, so we | ||
can't rely only on the WebPublishMethod. --> | ||
<PropertyGroup> | ||
<!-- Allow preview 7, any RC, or any stable version of 7 --> | ||
<_IsAllowedVersion Condition="$(NETCoreSdkVersion.StartsWith('7.0.100-preview.7')) or $(NETCoreSdkVersion.StartsWith('7.0.100-rc')) or ($(NETCoreSdkVersion.StartsWith('7.0.10')) and $(NETCoreSdkVersion.Contains('-')) == false)">true</_IsAllowedVersion> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MSBuild functions for semver compares when? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I explicitly scoped it out dotnet/msbuild#3212 (comment)! Land me dotnet/runtime#19317 and I will plumb it through immediately. |
||
</PropertyGroup> | ||
<Error Condition="'$(_IsAllowedVersion)' != 'true'" Code="CONTAINER002" Text="The current .NET SDK ($(NETCoreSdkVersion)) doesn't support containerization. Please use version 7.0.100-preview.7 or higher." /> | ||
</Target> | ||
|
||
<Target Name="ComputeContainerConfig"> | ||
<!-- Reference data about this project --> | ||
<PropertyGroup> | ||
|
@@ -58,6 +72,7 @@ | |
|
||
<PropertyGroup> | ||
<PublishContainerDependsOn> | ||
_ContainerVerifySDKVersion; | ||
ComputeContainerConfig | ||
</PublishContainerDependsOn> | ||
</PropertyGroup> | ||
|
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.
we can't rely on the Container target hookups having been executed in a build, so we need to establish some reasonable point at which to do this check. AfterPublish seemed good.