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 Namespace import based on TargetFramework and framework version and adjust VB defaults #1188

Merged
merged 1 commit into from
May 22, 2017

Conversation

basoundr
Copy link
Contributor

@basoundr basoundr commented May 8, 2017

Tagging @srivatsn @davkean @dotnet/project-system for review

@@ -17,15 +17,18 @@ Copyright (c) .NET Foundation. All rights reserved.
<PropertyGroup>
<DefineConstants>$(DefineConstants),$(ImplicitFrameworkDefine)</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework'">
Copy link
Contributor

Choose a reason for hiding this comment

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

The condition on TFM doesn't sound right. So netstandard libraries don't get these default imports?

Copy link
Contributor

Choose a reason for hiding this comment

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

For that reason you probably also want a different property to disable the default imports.

@@ -17,15 +17,18 @@ Copyright (c) .NET Foundation. All rights reserved.
<PropertyGroup>
<DefineConstants>$(DefineConstants),$(ImplicitFrameworkDefine)</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework'">
<!-- These namespaces are present in 2.0 Framework assemblies -->
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say just drop System.Data altogether since that's not in the default set of referneces for netstandard\netcore

@@ -31,4 +31,14 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- This namespace is introduced in 4.0 Framework assemblies -->
<Import Include="System.Threading.Tasks" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '4.0' "/>
</ItemGroup>
<ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(_IsNETCoreOrNETStandard)' == 'true'">
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use some new property instead of DisableImplicitFrameworkReferences - probably something like DisableImplicitImports. However for .NETFramework, we should check both properties.

@livarcocc
Copy link
Contributor

@MattGertz for approval.

<OptionCompare Condition=" '$(OptionCompare)' == '' ">Binary</OptionCompare>
<OptionStrict Condition=" '$(OptionStrict)' == '' ">Off</OptionStrict>
<OptionInfer Condition=" '$(OptionInfer)' == '' ">On</OptionInfer>
<DisableImplicitNamespaceImports Condition="'$(DisableImplicitNamespaceImports)'==''">$(DisableImplicitFrameworkReferences)</DisableImplicitNamespaceImports>
Copy link
Member

Choose a reason for hiding this comment

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

This line (setting DisableImplicitNamespaceImports) should probably go in the .targets instead of the .props. People will set DisableImplicitFrameworkReferences in the body of their project, but if this line is here then that won't affect the default value of DisableImplicitNamespaceImports.

@basoundr
Copy link
Contributor Author

@livarcocc Is the branching plan confirmed for 15.2? Will there be a 1.1.0 branch for this PR to retarget?

@livarcocc
Copy link
Contributor

@basoundr yes. there will be one. I will create it tomorrow and will let you know.

@basoundr basoundr changed the base branch from master to rel/1.1.0 May 18, 2017 21:27
…andard projects

The conditions are added to make them work appropriately

Also the VB default properties are set, only if they have not been set already.
@basoundr
Copy link
Contributor Author

@livarcocc I think there is a bunch of failing of testcases(8, I think. They could be flaky as well. Not sure.) in this branch. Those failures are unrelated to my change. Could you please have someone look into it?

@basoundr basoundr changed the title Add Namespace import based on TargetFramework and framework version Add Namespace import based on TargetFramework and framework version and adjust VB defaults May 19, 2017
@srivatsn
Copy link
Contributor

@dotnet-bot retest this please

@srivatsn srivatsn merged commit 8af7d2f into dotnet:rel/1.1.0 May 22, 2017
mmitche pushed a commit to mmitche/sdk that referenced this pull request Jun 5, 2020
…231.1 (dotnet#1188)

- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19631.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants