Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,49 +82,15 @@ Copyright (c) .NET Foundation. All rights reserved.

</ItemGroup>

<!-- Implicit imports -->
<ItemGroup Condition=" '$(DisableImplicitNamespaceImports_DotNet)' != 'true'
and '$(TargetFrameworkIdentifier)' == '.NETCoreApp'
and $([MSBuild]::VersionGreaterThanOrEquals($(_TargetFrameworkVersionWithoutV), '6.0'))">

<!-- Imports already defined as VB implicit imports are conditioned to not be added twice -->
<Import Include="System" Condition="'$(Language)' != 'VB'" />
<Import Include="System.Collections.Generic" Condition="'$(Language)' != 'VB'" />
<Import Include="System.IO" />
<Import Include="System.Linq" Condition="'$(Language)' != 'VB'" />
<Import Include="System.Net.Http" />
<Import Include="System.Threading" />
<Import Include="System.Threading.Tasks" Condition="'$(Language)' != 'VB'" />

</ItemGroup>

<!-- VB implicit imports -->
<ItemGroup Condition=" '$(DisableImplicitNamespaceImports)' != 'true'
and '$(Language)' == 'VB'
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" />
<Import Include="System.Diagnostics" />
<!-- These namespaces are introduced in 3.5 Framework assemblies -->
<Import Include="System.Linq" Condition="('$(_TargetFrameworkVersionWithoutV)' != '') And ('$(_TargetFrameworkVersionWithoutV)' >= '3.5')"/>
<Import Include="System.Xml.Linq" Condition="('$(_TargetFrameworkVersionWithoutV)' != '') And ('$(_TargetFrameworkVersionWithoutV)' >= '3.5')"/>
<!-- This namespace is introduced in 4.0 Framework assemblies -->
<Import Include="System.Threading.Tasks" Condition="('$(_TargetFrameworkVersionWithoutV)' != '') And ('$(_TargetFrameworkVersionWithoutV)' >= '4.0')"/>
</ItemGroup>
<ItemGroup Condition=" '$(DisableImplicitNamespaceImports)' != 'true'
and '$(Language)' == 'VB'
and '$(_IsNETCoreOrNETStandard)' == 'true'">
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Diagnostics" />
<Import Include="System.IO" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Net.Http" />
<Import Include="System.Threading" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@ Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition=" '$(DisableImplicitNamespaceImports)' != '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" />
<Import Include="System.Diagnostics" />
<!-- These namespaces are introduced in 3.5 Framework assemblies -->
<Import Include="System.Linq" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '3.5' "/>
<Import Include="System.Xml.Linq" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '3.5' "/>
<!-- This namespace is introduced in 4.0 Framework assemblies -->
<Import Include="System.Threading.Tasks" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '4.0' "/>
</ItemGroup>
<ItemGroup Condition=" '$(DisableImplicitNamespaceImports)' != 'true' and '$(_IsNETCoreOrNETStandard)' == 'true'">
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<PropertyGroup Condition="'$(DisableImplicitConfigurationDefines)' != 'true' and '$(Configuration)' != ''">
<ImplicitConfigurationDefine>$(Configuration.ToUpperInvariant())</ImplicitConfigurationDefine>

Expand Down
24 changes: 0 additions & 24 deletions src/Tests/dotnet.Tests/GivenThatICareAboutVBApps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,6 @@ public GivenThatICareAboutVBApps(ITestOutputHelper log) : base(log)
{
}

[Fact]
public void ICanRemoveSpecificImportsInProjectFile()
{
var testProject = new TestProject
{
IsExe = true,
TargetFrameworks = "netcoreapp3.0",
ProjectSdk = "Microsoft.NET.Sdk"
};
testProject.SourceFiles["Program.vb"] = @"
Module Program
Sub Main(args As String())
Console.WriteLine(""Hello World!"")
End Sub
End Module
";
testProject.AdditionalItems["Import"] = new Dictionary<string, string> { ["Remove"] = "System" };
var testInstance = _testAssetsManager.CreateTestProject(testProject);

new BuildCommand(testInstance)
.Execute()
.Should().Fail();
}

[Fact]
public void ICanBuildVBApps()
{
Expand Down