Skip to content

Add Namespace import based on TargetFramework and framework version and adjust VB defaults - #1188

Merged
srivatsn merged 1 commit into
dotnet:rel/1.1.0from
basoundr:VBDefaults
May 22, 2017
Merged

srivatsn merged 1 commit into
dotnet:rel/1.1.0from
basoundr:VBDefaults

Conversation

@basoundr

@basoundr basoundr commented May 8, 2017 •

Copy link
Copy Markdown
Contributor

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

<DefineConstants>$(DefineConstants),$(ImplicitFrameworkDefine)</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework'">

Copy link
Copy Markdown
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
Copy Markdown
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.

<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />

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

<!-- 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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