Skip to content
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

Merged
merged 2 commits into from
Aug 26, 2022

Conversation

baronfel
Copy link
Member

If a user explicitly asks for containerization we should be able to tell them if it's not supported.

Strictly speaking this means that they need to be on 7.0.100-preview.7 or higher.

If they are using a custom publish profile, they will have set the WebPublishMethod explicitly, so we can check that to cover that case. If they are using the default publish profile, they will never actually load the nonexistent profile on unsupported SDK versions, so we should check for the explicit use of the default profile.

@baronfel baronfel changed the base branch from main to v0.1 August 25, 2022 17:33
@@ -1,4 +1,18 @@
<Project>
<Target Name="_ContainerVerifySDKVersion"
Condition="'$(WebPublishMethod)' == 'Container' or '$(PublishProfile)' == 'DefaultContainer'"
BeforeTargets="AfterPublish">
Copy link
Member Author

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.

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>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSBuild functions for semver compares when?

Copy link
Member

Choose a reason for hiding this comment

The 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.

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>
Copy link
Member

Choose a reason for hiding this comment

The 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.

@baronfel baronfel merged commit 11dc555 into v0.1 Aug 26, 2022
@baronfel baronfel deleted the sdk-version-warning branch August 26, 2022 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants