diff --git a/src/MSBuild.Abstractions/MSBuildConversionWorkspace.cs b/src/MSBuild.Abstractions/MSBuildConversionWorkspace.cs index 9a2d9fb28..065ebb89f 100644 --- a/src/MSBuild.Abstractions/MSBuildConversionWorkspace.cs +++ b/src/MSBuild.Abstractions/MSBuildConversionWorkspace.cs @@ -43,7 +43,7 @@ public MSBuildConversionWorkspace(ImmutableArray paths, bool noBackup, s RemoveTargetsNotLoadableByNETSDKMSBuild(path); var root = new MSBuildProjectRootElement(ProjectRootElement.Open(path, collection, preserveFormatting: true)); - if (IsSupportedProjectType(root, forceWeb)) + if (IsSupportedProjectType(root, forceWeb, keepCurrentTFMs)) { var configurations = DetermineConfigurations(root); @@ -305,7 +305,7 @@ private ProjectStyle GetProjectStyle(IProjectRootElement projectRootElement) } } - private bool IsSupportedProjectType(IProjectRootElement root, bool forceWeb) + private bool IsSupportedProjectType(IProjectRootElement root, bool forceWeb, bool keepCurrentTFMs) { if (root.Sdk.ContainsIgnoreCase(MSBuildFacts.DefaultSDKAttribute)) { @@ -329,6 +329,13 @@ private bool IsSupportedProjectType(IProjectRootElement root, bool forceWeb) Console.WriteLine($"{root.FullPath} contains an App.config file. App.config is replaced by appsettings.json in .NET Core. You will need to delete App.config and migrate to appsettings.json if it's applicable to your project."); } + if (!keepCurrentTFMs + && root.PropertyGroups.Any(pg => pg.Properties.Any(ProjectPropertyHelpers.IsVisualBasicProject)) + && root.ItemGroups.Any(ig => ig.Items.Any(ProjectItemHelpers.IsReferencingSettingsSingleFileGenerator))) + { + Console.WriteLine($"{root.FullPath} uses code generators which will not be handled by try-convert. You can edit your vbproj to add support or remove these dependencies."); + } + // Lots of wild old project types have project type guids that the old project system uses to light things up! // Also some references that are incompatible. var projectType = GetProjectSupportType(root); diff --git a/src/MSBuild.Abstractions/ProjectItemHelpers.cs b/src/MSBuild.Abstractions/ProjectItemHelpers.cs index 056bd88ba..c6ddda04c 100644 --- a/src/MSBuild.Abstractions/ProjectItemHelpers.cs +++ b/src/MSBuild.Abstractions/ProjectItemHelpers.cs @@ -124,5 +124,12 @@ public static bool IsExplicitValueTupleReferenceThatCanBeRemoved(ProjectItemElem public static bool IsReferencingSystemWeb(ProjectItemElement item) => item.ElementName.Equals(MSBuildFacts.MSBuildReferenceName, StringComparison.OrdinalIgnoreCase) && item.Include.Equals(MSBuildFacts.SystemWebReferenceName, StringComparison.OrdinalIgnoreCase); + + public static bool IsReferencingSettingsSingleFileGenerator(ProjectItemElement item) + { + var metadata = item.Children.FirstOrDefault(child => MSBuildFacts.EmbeddedResourceGeneratorProperty.Equals(child.ElementName, StringComparison.Ordinal) ) as ProjectMetadataElement; + return metadata is null ? false : metadata.Value.Equals(MSBuildFacts.SettingsSingleFileGenerator, StringComparison.Ordinal); + } + } } diff --git a/src/MSBuild.Abstractions/ProjectPropertyHelpers.cs b/src/MSBuild.Abstractions/ProjectPropertyHelpers.cs index c2ef71142..c9ad6d331 100644 --- a/src/MSBuild.Abstractions/ProjectPropertyHelpers.cs +++ b/src/MSBuild.Abstractions/ProjectPropertyHelpers.cs @@ -162,5 +162,9 @@ public static bool IsExeOutputType(ProjectPropertyElement prop) => public static bool IsWinExeOutputType(ProjectPropertyElement prop) => prop.ElementName.Equals(MSBuildFacts.OutputTypeNodeName, StringComparison.OrdinalIgnoreCase) && prop.Value.Equals(MSBuildFacts.WinExeOutputType, StringComparison.OrdinalIgnoreCase); + + + public static bool IsVisualBasicProject(ProjectPropertyElement prop) => + IsProjectTypeGuidsNode(prop) && prop.Value.Split(';').Any(guidString => Guid.Parse(guidString) == MSBuildFacts.LanguageProjectTypeVisualBasic); } } diff --git a/src/MSBuild.Conversion.Facts/DesktopFacts.cs b/src/MSBuild.Conversion.Facts/DesktopFacts.cs index 9ee65ec8d..0f930322d 100644 --- a/src/MSBuild.Conversion.Facts/DesktopFacts.cs +++ b/src/MSBuild.Conversion.Facts/DesktopFacts.cs @@ -47,6 +47,7 @@ public static class DesktopFacts ); public static ImmutableArray KnownSupportedDesktopProjectTypeGuids => ImmutableArray.Create( + MSBuildFacts.LanguageProjectTypeVisualBasic, // VB.NET Guid.Parse("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"), // C# Guid.Parse("{60DC8134-EBA5-43B8-BCC9-BB4BC16C2548}") // WPF ); diff --git a/src/MSBuild.Conversion.Facts/MSBuildFacts.cs b/src/MSBuild.Conversion.Facts/MSBuildFacts.cs index caa2ccf1b..1887487a6 100644 --- a/src/MSBuild.Conversion.Facts/MSBuildFacts.cs +++ b/src/MSBuild.Conversion.Facts/MSBuildFacts.cs @@ -246,10 +246,12 @@ public static class MSBuildFacts "ProjectReference" ); + public static Guid LanguageProjectTypeVisualBasic => Guid.Parse("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"); + public static ImmutableArray LanguageProjectTypeGuids => ImmutableArray.Create( Guid.Parse("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"), // C# - Guid.Parse("{F2A71F9B-5D33-465A-A702-920D77279786}"), // VB.NET - Guid.Parse("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") // F# + LanguageProjectTypeVisualBasic, // VB.NET + Guid.Parse("{F2A71F9B-5D33-465A-A702-920D77279786}") // F# ); public const string DefaultSDKAttribute = "Microsoft.NET.Sdk"; @@ -296,5 +298,7 @@ public static class MSBuildFacts public const string Net5 = "net5.0"; public const string Net5Windows = "net5.0-windows"; public const string AppConfig = "App.config"; + public const string EmbeddedResourceGeneratorProperty = "Generator"; + public const string SettingsSingleFileGenerator = "SettingsSingleFileGenerator"; } } diff --git a/src/MSBuild.Conversion.Facts/MSTestFacts.cs b/src/MSBuild.Conversion.Facts/MSTestFacts.cs index 76d7d7b74..7b764ff52 100644 --- a/src/MSBuild.Conversion.Facts/MSTestFacts.cs +++ b/src/MSBuild.Conversion.Facts/MSTestFacts.cs @@ -15,6 +15,7 @@ public static class MSTestFacts ); public static ImmutableArray KnownOldMSTestProjectTypeGuids => ImmutableArray.Create( + MSBuildFacts.LanguageProjectTypeVisualBasic, // VB.NET Guid.Parse("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"), // C# Guid.Parse("{3AC096D0-A1C2-E12C-1390-A8335801FDAB}") // Test ); diff --git a/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Application.Designer.vb b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Application.Designer.vb new file mode 100644 index 000000000..88dd01c78 --- /dev/null +++ b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Application.myapp b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Application.myapp new file mode 100644 index 000000000..758895def --- /dev/null +++ b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 1 + true + diff --git a/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/AssemblyInfo.vb b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/AssemblyInfo.vb new file mode 100644 index 000000000..b07c6a73a --- /dev/null +++ b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/AssemblyInfo.vb @@ -0,0 +1,18 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + + + + + + + + + + + + +' + + diff --git a/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Resources.Designer.vb b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Resources.Designer.vb new file mode 100644 index 000000000..34b745d6e --- /dev/null +++ b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("UnitTestProject1.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Resources.resx b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Settings.Designer.vb b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Settings.Designer.vb new file mode 100644 index 000000000..98ea5b9c5 --- /dev/null +++ b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.UnitTestProject1.My.MySettings + Get + Return Global.UnitTestProject1.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Settings.settings b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Settings.settings new file mode 100644 index 000000000..85b890b3c --- /dev/null +++ b/tests/TestData/SmokeTests.LegacyMSTestVB/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/TestData/SmokeTests.LegacyMSTestVB/SmokeTests.LegacyMSTestVB.vbproj b/tests/TestData/SmokeTests.LegacyMSTestVB/SmokeTests.LegacyMSTestVB.vbproj new file mode 100644 index 000000000..5f539113b --- /dev/null +++ b/tests/TestData/SmokeTests.LegacyMSTestVB/SmokeTests.LegacyMSTestVB.vbproj @@ -0,0 +1,128 @@ + + + + + + Debug + AnyCPU + {93C41606-BC53-4B81-A905-2086C0DADD6E} + Library + UnitTestProject1 + UnitTestProject1 + 512 + Windows + v4.8 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + true + true + bin\Debug\ + UnitTestProject1.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + pdbonly + false + true + true + bin\Release\ + UnitTestProject1.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + ..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.LegacyMSTestVB/UnitTest1.vb b/tests/TestData/SmokeTests.LegacyMSTestVB/UnitTest1.vb new file mode 100644 index 000000000..9dd9a0801 --- /dev/null +++ b/tests/TestData/SmokeTests.LegacyMSTestVB/UnitTest1.vb @@ -0,0 +1,9 @@ +Imports System.Text +Imports Microsoft.VisualStudio.TestTools.UnitTesting + + Public Class UnitTest1 + + Public Sub TestMethod1() + End Sub + +End Class \ No newline at end of file diff --git a/tests/TestData/SmokeTests.LegacyMSTestVB/packages.config b/tests/TestData/SmokeTests.LegacyMSTestVB/packages.config new file mode 100644 index 000000000..e3b894841 --- /dev/null +++ b/tests/TestData/SmokeTests.LegacyMSTestVB/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Application.Designer.vb b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Application.Designer.vb new file mode 100644 index 000000000..88dd01c78 --- /dev/null +++ b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Application.myapp b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Application.myapp new file mode 100644 index 000000000..758895def --- /dev/null +++ b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 1 + true + diff --git a/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/AssemblyInfo.vb b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/AssemblyInfo.vb new file mode 100644 index 000000000..b69315bdd --- /dev/null +++ b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/AssemblyInfo.vb @@ -0,0 +1,18 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + + + + + + + + + + + + +' + + diff --git a/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Resources.Designer.vb b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Resources.Designer.vb new file mode 100644 index 000000000..6522f5e86 --- /dev/null +++ b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("MyVBTestProject.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Resources.resx b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Settings.Designer.vb b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Settings.Designer.vb new file mode 100644 index 000000000..9b9fabf18 --- /dev/null +++ b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.MyVBTestProject.My.MySettings + Get + Return Global.MyVBTestProject.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Settings.settings b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Settings.settings new file mode 100644 index 000000000..85b890b3c --- /dev/null +++ b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/TestData/SmokeTests.MSTestVbNet5Baseline/SmokeTests.MSTestVbNet5Baseline.vbproj b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/SmokeTests.MSTestVbNet5Baseline.vbproj new file mode 100644 index 000000000..c8b5ae7f7 --- /dev/null +++ b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/SmokeTests.MSTestVbNet5Baseline.vbproj @@ -0,0 +1,65 @@ + + + UnitTestProject1 + UnitTestProject1 + Windows + + + UnitTestProject1.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + false + UnitTestProject1.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + net5.0-windows + false + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + + + + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.MSTestVbNet5Baseline/UnitTest1.vb b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/UnitTest1.vb new file mode 100644 index 000000000..9dd9a0801 --- /dev/null +++ b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/UnitTest1.vb @@ -0,0 +1,9 @@ +Imports System.Text +Imports Microsoft.VisualStudio.TestTools.UnitTesting + + Public Class UnitTest1 + + Public Sub TestMethod1() + End Sub + +End Class \ No newline at end of file diff --git a/tests/TestData/SmokeTests.MSTestVbNet5Baseline/packages.config b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/packages.config new file mode 100644 index 000000000..e3b894841 --- /dev/null +++ b/tests/TestData/SmokeTests.MSTestVbNet5Baseline/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.WpfVbFramework/App.config b/tests/TestData/SmokeTests.WpfVbFramework/App.config new file mode 100644 index 000000000..193aecc67 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.WpfVbFramework/Application.xaml b/tests/TestData/SmokeTests.WpfVbFramework/Application.xaml new file mode 100644 index 000000000..a1e4723d6 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/Application.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/tests/TestData/SmokeTests.WpfVbFramework/Application.xaml.vb b/tests/TestData/SmokeTests.WpfVbFramework/Application.xaml.vb new file mode 100644 index 000000000..084cbe917 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/Application.xaml.vb @@ -0,0 +1,6 @@ +Class Application + + ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException + ' can be handled in this file. + +End Class diff --git a/tests/TestData/SmokeTests.WpfVbFramework/MainWindow.xaml b/tests/TestData/SmokeTests.WpfVbFramework/MainWindow.xaml new file mode 100644 index 000000000..9e5eac609 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/tests/TestData/SmokeTests.WpfVbFramework/MainWindow.xaml.vb b/tests/TestData/SmokeTests.WpfVbFramework/MainWindow.xaml.vb new file mode 100644 index 000000000..922a5dedd --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/MainWindow.xaml.vb @@ -0,0 +1,3 @@ +Class MainWindow + +End Class diff --git a/tests/TestData/SmokeTests.WpfVbFramework/My Project/AssemblyInfo.vb b/tests/TestData/SmokeTests.WpfVbFramework/My Project/AssemblyInfo.vb new file mode 100644 index 000000000..261ce7b76 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/My Project/AssemblyInfo.vb @@ -0,0 +1,59 @@ +Imports System +Imports System.Globalization +Imports System.Reflection +Imports System.Resources +Imports System.Runtime.InteropServices +Imports System.Windows + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'In order to begin building localizable applications, set +'CultureYouAreCodingWith in your .vbproj file +'inside a . For example, if you are using US english +'in your source files, set the to "en-US". Then uncomment the +'NeutralResourceLanguage attribute below. Update the "en-US" in the line +'below to match the UICulture setting in the project file. + +' + + +'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found. +'1st parameter: where theme specific resource dictionaries are located +'(used if a resource is not found in the page, +' or application resource dictionaries) + +'2nd parameter: where the generic resource dictionary is located +'(used if a resource is not found in the page, +'app, and any theme specific resource dictionaries) + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/tests/TestData/SmokeTests.WpfVbFramework/My Project/MyExtensions/MyWpfExtension.vb b/tests/TestData/SmokeTests.WpfVbFramework/My Project/MyExtensions/MyWpfExtension.vb new file mode 100644 index 000000000..22f84b7da --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/My Project/MyExtensions/MyWpfExtension.vb @@ -0,0 +1,121 @@ +#If _MyType <> "Empty" Then + +Namespace My + ''' + ''' Module used to define the properties that are available in the My Namespace for WPF + ''' + ''' + _ + Module MyWpfExtension + Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.Computer) + Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.User) + Private s_Windows As New ThreadSafeObjectProvider(Of MyWindows) + Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.Log) + ''' + ''' Returns the application object for the running application + ''' + _ + Friend ReadOnly Property Application() As Application + Get + Return CType(Global.System.Windows.Application.Current, Application) + End Get + End Property + ''' + ''' Returns information about the host computer. + ''' + _ + Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer + Get + Return s_Computer.GetInstance() + End Get + End Property + ''' + ''' Returns information for the current user. If you wish to run the application with the current + ''' Windows user credentials, call My.User.InitializeWithWindowsUser(). + ''' + _ + Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User + Get + Return s_User.GetInstance() + End Get + End Property + ''' + ''' Returns the application log. The listeners can be configured by the application's configuration file. + ''' + _ + Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log + Get + Return s_Log.GetInstance() + End Get + End Property + + ''' + ''' Returns the collection of Windows defined in the project. + ''' + _ + Friend ReadOnly Property Windows() As MyWindows + _ + Get + Return s_Windows.GetInstance() + End Get + End Property + _ + _ + Friend NotInheritable Class MyWindows + _ + Private Shared Function Create__Instance__(Of T As {New, Global.System.Windows.Window})(ByVal Instance As T) As T + If Instance Is Nothing Then + If s_WindowBeingCreated IsNot Nothing Then + If s_WindowBeingCreated.ContainsKey(GetType(T)) = True Then + Throw New Global.System.InvalidOperationException("The window cannot be accessed via My.Windows from the Window constructor.") + End If + Else + s_WindowBeingCreated = New Global.System.Collections.Hashtable() + End If + s_WindowBeingCreated.Add(GetType(T), Nothing) + Return New T() + s_WindowBeingCreated.Remove(GetType(T)) + Else + Return Instance + End If + End Function + _ + _ + Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T) + instance = Nothing + End Sub + _ + _ + Public Sub New() + MyBase.New() + End Sub + Private Shared s_WindowBeingCreated As Global.System.Collections.Hashtable + Public Overrides Function Equals(ByVal o As Object) As Boolean + Return MyBase.Equals(o) + End Function + Public Overrides Function GetHashCode() As Integer + Return MyBase.GetHashCode + End Function + _ + _ + Friend Overloads Function [GetType]() As Global.System.Type + Return GetType(MyWindows) + End Function + Public Overrides Function ToString() As String + Return MyBase.ToString + End Function + End Class + End Module +End Namespace +Partial Class Application + Inherits Global.System.Windows.Application + _ + _ + Friend ReadOnly Property Info() As Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo + _ + Get + Return New Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(Global.System.Reflection.Assembly.GetExecutingAssembly()) + End Get + End Property +End Class +#End If \ No newline at end of file diff --git a/tests/TestData/SmokeTests.WpfVbFramework/My Project/Resources.Designer.vb b/tests/TestData/SmokeTests.WpfVbFramework/My Project/Resources.Designer.vb new file mode 100644 index 000000000..e7ecddcab --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:$clrversion$ +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("$safeprojectname$.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/tests/TestData/SmokeTests.WpfVbFramework/My Project/Resources.resx b/tests/TestData/SmokeTests.WpfVbFramework/My Project/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.WpfVbFramework/My Project/Settings.Designer.vb b/tests/TestData/SmokeTests.WpfVbFramework/My Project/Settings.Designer.vb new file mode 100644 index 000000000..2d862e9e5 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.WpfApp1.My.MySettings + Get + Return Global.WpfApp1.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/tests/TestData/SmokeTests.WpfVbFramework/My Project/Settings.settings b/tests/TestData/SmokeTests.WpfVbFramework/My Project/Settings.settings new file mode 100644 index 000000000..40ed9fdba --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.WpfVbFramework/SmokeTests.WpfVbFramework.vbproj b/tests/TestData/SmokeTests.WpfVbFramework/SmokeTests.WpfVbFramework.vbproj new file mode 100644 index 000000000..4f22cb6e2 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbFramework/SmokeTests.WpfVbFramework.vbproj @@ -0,0 +1,135 @@ + + + + Debug + AnyCPU + {C50BD466-83C9-4481-82D7-279BC639B5B0} + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} + WinExe + WpfApp1 + WpfApp1 + v4.8 + Custom + true + true + + + AnyCPU + true + full + true + true + true + bin\Debug\ + WpfApp1.xml + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314 + + + AnyCPU + pdbonly + false + false + true + false + true + bin\Release\ + WpfApp1.xml + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314 + + + On + + + Binary + + + Off + + + On + + + + + + + + + + 4.0 + + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Application.xaml + Code + + + MainWindow.xaml + Code + + + + + + + + + + + + + + + + + + + + + + + + Code + + + Microsoft.VisualBasic.WPF.MyExtension + 1.0.0.0 + + + True + True + Resources.resx + + + True + Settings.settings + True + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + + + SettingsSingleFileGenerator + Settings.Designer.vb + + + + + + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/App.config b/tests/TestData/SmokeTests.WpfVbNet5Baseline/App.config new file mode 100644 index 000000000..193aecc67 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/Application.xaml b/tests/TestData/SmokeTests.WpfVbNet5Baseline/Application.xaml new file mode 100644 index 000000000..a1e4723d6 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/Application.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/Application.xaml.vb b/tests/TestData/SmokeTests.WpfVbNet5Baseline/Application.xaml.vb new file mode 100644 index 000000000..084cbe917 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/Application.xaml.vb @@ -0,0 +1,6 @@ +Class Application + + ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException + ' can be handled in this file. + +End Class diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/MainWindow.xaml b/tests/TestData/SmokeTests.WpfVbNet5Baseline/MainWindow.xaml new file mode 100644 index 000000000..9e5eac609 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/MainWindow.xaml.vb b/tests/TestData/SmokeTests.WpfVbNet5Baseline/MainWindow.xaml.vb new file mode 100644 index 000000000..922a5dedd --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/MainWindow.xaml.vb @@ -0,0 +1,3 @@ +Class MainWindow + +End Class diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/AssemblyInfo.vb b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/AssemblyInfo.vb new file mode 100644 index 000000000..261ce7b76 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/AssemblyInfo.vb @@ -0,0 +1,59 @@ +Imports System +Imports System.Globalization +Imports System.Reflection +Imports System.Resources +Imports System.Runtime.InteropServices +Imports System.Windows + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'In order to begin building localizable applications, set +'CultureYouAreCodingWith in your .vbproj file +'inside a . For example, if you are using US english +'in your source files, set the to "en-US". Then uncomment the +'NeutralResourceLanguage attribute below. Update the "en-US" in the line +'below to match the UICulture setting in the project file. + +' + + +'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found. +'1st parameter: where theme specific resource dictionaries are located +'(used if a resource is not found in the page, +' or application resource dictionaries) + +'2nd parameter: where the generic resource dictionary is located +'(used if a resource is not found in the page, +'app, and any theme specific resource dictionaries) + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/MyExtensions/MyWpfExtension.vb b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/MyExtensions/MyWpfExtension.vb new file mode 100644 index 000000000..22f84b7da --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/MyExtensions/MyWpfExtension.vb @@ -0,0 +1,121 @@ +#If _MyType <> "Empty" Then + +Namespace My + ''' + ''' Module used to define the properties that are available in the My Namespace for WPF + ''' + ''' + _ + Module MyWpfExtension + Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.Computer) + Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.User) + Private s_Windows As New ThreadSafeObjectProvider(Of MyWindows) + Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.Log) + ''' + ''' Returns the application object for the running application + ''' + _ + Friend ReadOnly Property Application() As Application + Get + Return CType(Global.System.Windows.Application.Current, Application) + End Get + End Property + ''' + ''' Returns information about the host computer. + ''' + _ + Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer + Get + Return s_Computer.GetInstance() + End Get + End Property + ''' + ''' Returns information for the current user. If you wish to run the application with the current + ''' Windows user credentials, call My.User.InitializeWithWindowsUser(). + ''' + _ + Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User + Get + Return s_User.GetInstance() + End Get + End Property + ''' + ''' Returns the application log. The listeners can be configured by the application's configuration file. + ''' + _ + Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log + Get + Return s_Log.GetInstance() + End Get + End Property + + ''' + ''' Returns the collection of Windows defined in the project. + ''' + _ + Friend ReadOnly Property Windows() As MyWindows + _ + Get + Return s_Windows.GetInstance() + End Get + End Property + _ + _ + Friend NotInheritable Class MyWindows + _ + Private Shared Function Create__Instance__(Of T As {New, Global.System.Windows.Window})(ByVal Instance As T) As T + If Instance Is Nothing Then + If s_WindowBeingCreated IsNot Nothing Then + If s_WindowBeingCreated.ContainsKey(GetType(T)) = True Then + Throw New Global.System.InvalidOperationException("The window cannot be accessed via My.Windows from the Window constructor.") + End If + Else + s_WindowBeingCreated = New Global.System.Collections.Hashtable() + End If + s_WindowBeingCreated.Add(GetType(T), Nothing) + Return New T() + s_WindowBeingCreated.Remove(GetType(T)) + Else + Return Instance + End If + End Function + _ + _ + Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T) + instance = Nothing + End Sub + _ + _ + Public Sub New() + MyBase.New() + End Sub + Private Shared s_WindowBeingCreated As Global.System.Collections.Hashtable + Public Overrides Function Equals(ByVal o As Object) As Boolean + Return MyBase.Equals(o) + End Function + Public Overrides Function GetHashCode() As Integer + Return MyBase.GetHashCode + End Function + _ + _ + Friend Overloads Function [GetType]() As Global.System.Type + Return GetType(MyWindows) + End Function + Public Overrides Function ToString() As String + Return MyBase.ToString + End Function + End Class + End Module +End Namespace +Partial Class Application + Inherits Global.System.Windows.Application + _ + _ + Friend ReadOnly Property Info() As Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo + _ + Get + Return New Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(Global.System.Reflection.Assembly.GetExecutingAssembly()) + End Get + End Property +End Class +#End If \ No newline at end of file diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Resources.Designer.vb b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Resources.Designer.vb new file mode 100644 index 000000000..e7ecddcab --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:$clrversion$ +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("$safeprojectname$.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Resources.resx b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Settings.Designer.vb b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Settings.Designer.vb new file mode 100644 index 000000000..2d862e9e5 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.WpfApp1.My.MySettings + Get + Return Global.WpfApp1.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Settings.settings b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Settings.settings new file mode 100644 index 000000000..40ed9fdba --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/tests/TestData/SmokeTests.WpfVbNet5Baseline/SmokeTests.WpfVbNet5Baseline.vbproj b/tests/TestData/SmokeTests.WpfVbNet5Baseline/SmokeTests.WpfVbNet5Baseline.vbproj new file mode 100644 index 000000000..6f8f63be6 --- /dev/null +++ b/tests/TestData/SmokeTests.WpfVbNet5Baseline/SmokeTests.WpfVbNet5Baseline.vbproj @@ -0,0 +1,54 @@ + + + net5.0-windows + WinExe + WpfApp1 + WpfApp1 + Custom + false + true + true + + + true + WpfApp1.xml + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314 + + + false + false + WpfApp1.xml + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314 + + + + + + + + + + + + + + + Microsoft.VisualBasic.WPF.MyExtension + 1.0.0.0 + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/tests/end-to-end/Smoke.Tests/BasicConversions.cs b/tests/end-to-end/Smoke.Tests/BasicConversions.cs index eb29ea6c8..306adf763 100644 --- a/tests/end-to-end/Smoke.Tests/BasicConversions.cs +++ b/tests/end-to-end/Smoke.Tests/BasicConversions.cs @@ -20,6 +20,8 @@ public class BasicSmokeTests : IClassFixture, IClassFixture private string TestDataPath => Path.Combine(SolutionPath, "tests", "TestData"); private string GetFSharpProjectPath(string projectName) => Path.Combine(TestDataPath, projectName, $"{projectName}.fsproj"); private string GetCSharpProjectPath(string projectName) => Path.Combine(TestDataPath, projectName, $"{projectName}.csproj"); + private string GetVisualBasicProjectPath(string projectName) => Path.Combine(TestDataPath, projectName, $"{projectName}.vbproj"); + public BasicSmokeTests(SolutionPathFixture solutionPathFixture, MSBuildFixture msBuildFixture) { msBuildFixture.RegisterInstance(); @@ -58,6 +60,14 @@ public void ConvertsWpfFrameworkTemplateForNet50() AssertConversionWorks(projectToConvertPath, projectBaselinePath, "net5.0-windows"); } + [Fact] + public void ConvertsWpfVbFrameworkTemplateForNet50() + { + var projectToConvertPath = GetVisualBasicProjectPath("SmokeTests.WpfVbFramework"); + var projectBaselinePath = GetVisualBasicProjectPath("SmokeTests.WpfVbNet5Baseline"); + AssertConversionWorks(projectToConvertPath, projectBaselinePath, "net5.0-windows"); + } + [Fact] public void ConvertsWinformsFrameworkTemplateForNetCoreApp31() { @@ -82,6 +92,14 @@ public void ConvertsLegacyMSTest() AssertConversionWorks(projectToConvertPath, projectBaselinePath, "netcoreapp3.1"); } + [Fact] + public void ConvertsLegacyMSTestVB() + { + var projectToConvertPath = GetVisualBasicProjectPath("SmokeTests.LegacyMSTestVB"); + var projectBaselinePath = GetVisualBasicProjectPath("SmokeTests.MSTestVbNet5Baseline"); + AssertConversionWorks(projectToConvertPath, projectBaselinePath, "net5.0-windows"); + } + [Fact] public void ConvertsLegacyWebLibraryToNetFx() {