diff --git a/ConsoleApp1/ConsoleApp1.csproj b/ConsoleApp1/ConsoleApp1.csproj index d770a91..64651ab 100644 --- a/ConsoleApp1/ConsoleApp1.csproj +++ b/ConsoleApp1/ConsoleApp1.csproj @@ -7,7 +7,11 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/ConsoleApp1/Program.cs b/ConsoleApp1/Program.cs index 7ff9ef5..a936ee1 100644 --- a/ConsoleApp1/Program.cs +++ b/ConsoleApp1/Program.cs @@ -16,9 +16,12 @@ class Program { static void Main(string[] args) { - Console.WriteLine($"reflection: {MeasureExecTime(ActivityTester.ActivityWithReflectionVoid)}"); - Console.WriteLine($"expression: {MeasureExecTime(ActivityTester.ActivityWithExpressionVoid)}"); - Console.WriteLine($"dynamicmethod: {MeasureExecTime(ActivityTester.ActivityWithDynamicMethodVoid)}"); + //Console.WriteLine($"reflection: {MeasureExecTime(ActivityTester.ActivityWithReflectionVoid)}"); + //Console.WriteLine($"expression: {MeasureExecTime(ActivityTester.ActivityWithExpressionVoid)}"); + //Console.WriteLine($"dynamicmethod: {MeasureExecTime(ActivityTester.ActivityWithDynamicMethodVoid)}"); + + var tester = new ActivityTester(); + tester.ActivityWithReflection(); //var summary = BenchmarkRunner.Run(); //var summary = BenchmarkRunner.Run(); @@ -45,19 +48,25 @@ private static long MeasureExecTime(Action action) #endif public class ActivityTester { + private const string TestSourceName = "TestSourceName"; + private DiagnosticSource diagnosticSource; + static PropertyInfo kindPropertyInfo = typeof(Activity).GetProperty("Kind"); - static Action setterNameProperty = CreateSetter("Kind"); + static Action setterNameProperty = CreateSetter("Source"); static Action kindSetterDynamicMethod = CreateSetterDynamicMethod(); + public ActivityTester() + { + this.diagnosticSource = new DiagnosticListener(TestSourceName); + } + #if !NET452 [Benchmark] #endif public Activity ActivityWithReflection() { - Activity activity = new Activity("activity-with-reflection"); - - kindPropertyInfo.SetValue(activity, ActivityKind.Client); - + var activity = new Activity("Main"); + setterNameProperty(activity, new ActivitySource("name")); return activity; } @@ -78,7 +87,7 @@ public Activity ActivityWithExpression() { var activity = new Activity("activity-with-expression"); - setterNameProperty(activity, ActivityKind.Client); + setterNameProperty(activity, new ActivitySource("name")); return activity; } @@ -89,7 +98,7 @@ public static void ActivityWithExpressionVoid() { var activity = new Activity("activity-with-expression"); - setterNameProperty(activity, ActivityKind.Client); + setterNameProperty(activity, new ActivitySource("name")); } } @@ -115,14 +124,14 @@ public static void ActivityWithDynamicMethodVoid() } } - public static Action CreateSetter(string name) + public static Action CreateSetter(string name) { ParameterExpression instance = Expression.Parameter(typeof(Activity), "instance"); - ParameterExpression propertyValue = Expression.Parameter(typeof(ActivityKind), "propertyValue"); + ParameterExpression propertyValue = Expression.Parameter(typeof(ActivitySource), "propertyValue"); var body = Expression.Assign(Expression.Property(instance, name), propertyValue); - return Expression.Lambda>(body, instance, propertyValue).Compile(); + return Expression.Lambda>(body, instance, propertyValue).Compile(); } public static Action CreateSetterDynamicMethod() diff --git a/ConsoleApp1/version.json b/ConsoleApp1/version.json new file mode 100644 index 0000000..32c2349 --- /dev/null +++ b/ConsoleApp1/version.json @@ -0,0 +1,3 @@ +{ + "version": "1.2.3" +} \ No newline at end of file diff --git a/VsixTestingSamples-master/.gitattributes b/VsixTestingSamples-master/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/VsixTestingSamples-master/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/VsixTestingSamples-master/.gitignore b/VsixTestingSamples-master/.gitignore new file mode 100644 index 0000000..3c4efe2 --- /dev/null +++ b/VsixTestingSamples-master/.gitignore @@ -0,0 +1,261 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/VsixTestingSamples-master/LICENSE.md b/VsixTestingSamples-master/LICENSE.md new file mode 100644 index 0000000..4d604f1 --- /dev/null +++ b/VsixTestingSamples-master/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jose Torres + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/VsixTestingSamples-master/README.md b/VsixTestingSamples-master/README.md new file mode 100644 index 0000000..3800230 --- /dev/null +++ b/VsixTestingSamples-master/README.md @@ -0,0 +1,3 @@ +# VsixTesting Samples + +This repo contains samples for https://github.com/josetr/VsixTesting. diff --git a/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage.Tests/VSPackageTests.cs b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage.Tests/VSPackageTests.cs new file mode 100644 index 0000000..0bef441 --- /dev/null +++ b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage.Tests/VSPackageTests.cs @@ -0,0 +1,28 @@ +using Microsoft; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; +using System; +using Xunit; +using Task = System.Threading.Tasks.Task; + +namespace VsAsyncPackage.Tests +{ + public class AsyncPackageTests + { + [VsTheory(Version = "2015-")] + [InlineData(VSPackage.PackageGuidString, true)] + [InlineData("11111111-2222-3333-4444-555555555555", false)] + async Task LoadTestAsync(string guidString, bool expectedSuccess) + { + var shell = (IVsShell7)ServiceProvider.GlobalProvider.GetService(typeof(SVsShell)); + Assumes.Present(shell); + + var guid = Guid.Parse(guidString); + + if (expectedSuccess) + await shell.LoadPackageAsync(ref guid); + else + await Assert.ThrowsAnyAsync(async () => await shell.LoadPackageAsync(ref guid)); + } + } +} diff --git a/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage.Tests/VsAsyncPackage.Tests.csproj b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage.Tests/VsAsyncPackage.Tests.csproj new file mode 100644 index 0000000..8b8440e --- /dev/null +++ b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage.Tests/VsAsyncPackage.Tests.csproj @@ -0,0 +1,16 @@ + + + net461 + x86 + + + + + + + + + + + + \ No newline at end of file diff --git a/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage.sln b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage.sln new file mode 100644 index 0000000..70c3044 --- /dev/null +++ b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.539 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VsAsyncPackage.Tests", "VsAsyncPackage.Tests\VsAsyncPackage.Tests.csproj", "{E298A62D-0A6E-495E-B1FD-BAE4AE676B34}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VsAsyncPackage", "VsAsyncPackage\VsAsyncPackage.csproj", "{67883C9D-D5C8-465A-8C2C-9CB49521B99B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E298A62D-0A6E-495E-B1FD-BAE4AE676B34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E298A62D-0A6E-495E-B1FD-BAE4AE676B34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E298A62D-0A6E-495E-B1FD-BAE4AE676B34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E298A62D-0A6E-495E-B1FD-BAE4AE676B34}.Release|Any CPU.Build.0 = Release|Any CPU + {67883C9D-D5C8-465A-8C2C-9CB49521B99B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {67883C9D-D5C8-465A-8C2C-9CB49521B99B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {67883C9D-D5C8-465A-8C2C-9CB49521B99B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {67883C9D-D5C8-465A-8C2C-9CB49521B99B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2F3F8B77-C2BA-4BCA-814A-E87494D1E43E} + EndGlobalSection +EndGlobal diff --git a/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/Key.snk b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/Key.snk new file mode 100644 index 0000000..72046ea Binary files /dev/null and b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/Key.snk differ diff --git a/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/Properties/AssemblyInfo.cs b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f6c68f4 --- /dev/null +++ b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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. +[assembly: AssemblyTitle("VsAsyncPackage")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("VsAsyncPackage")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// 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: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/Resources/VSPackage.ico b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/Resources/VSPackage.ico new file mode 100644 index 0000000..d323b07 Binary files /dev/null and b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/Resources/VSPackage.ico differ diff --git a/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/VSPackage.cs b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/VSPackage.cs new file mode 100644 index 0000000..b294869 --- /dev/null +++ b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/VSPackage.cs @@ -0,0 +1,31 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using System.Threading; +using Microsoft.VisualStudio.Shell; +using Task = System.Threading.Tasks.Task; + +namespace VsAsyncPackage +{ + [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] + [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About + [Guid(VSPackage.PackageGuidString)] + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] + public sealed class VSPackage : AsyncPackage + { + public const string PackageGuidString = "bf31fe07-674c-4411-be32-43a103efe1f4"; + + public VSPackage() + { + } + + #region Package Members + + protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + } + + #endregion + } +} diff --git a/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/VSPackage.resx b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/VSPackage.resx new file mode 100644 index 0000000..c441f03 --- /dev/null +++ b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/VSPackage.resx @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + VSPackage Extension + + + VSPackage Visual Studio Extension Detailed Info + + + Resources\VSPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/VsAsyncPackage.csproj b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/VsAsyncPackage.csproj new file mode 100644 index 0000000..85c65cb --- /dev/null +++ b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/VsAsyncPackage.csproj @@ -0,0 +1,100 @@ + + + + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + true + + + true + + + Key.snk + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {67883C9D-D5C8-465A-8C2C-9CB49521B99B} + Library + Properties + VsAsyncPackage + VsAsyncPackage + v4.6.1 + true + true + true + true + true + true + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + Designer + + + + + 14.0.81-pre + + + + + + + + + + + + + + + + + + + + VSPackage.cs + + + + + + + + + diff --git a/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/source.extension.vsixmanifest b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/source.extension.vsixmanifest new file mode 100644 index 0000000..79ecdf9 --- /dev/null +++ b/VsixTestingSamples-master/VsAsyncPackage/VsAsyncPackage/source.extension.vsixmanifest @@ -0,0 +1,21 @@ + + + + + VsAsyncPackage + VsAsyncPackage + + + + + + + + + + + + + + + diff --git a/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary.Tests/DteUtilitiesTests.cs b/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary.Tests/DteUtilitiesTests.cs new file mode 100644 index 0000000..da10ef0 --- /dev/null +++ b/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary.Tests/DteUtilitiesTests.cs @@ -0,0 +1,38 @@ +using Xunit; + +namespace VsClassLibrary.Tests +{ + [VsTestSettings(UIThread = true)] + public class DteUtilitiesTests + { + [VsFact(Version = "2012")] + void TestMethod11() + { + Assert.Equal("11.0", DteUtilities.GetVsVersion()); + } + + [VsFact(Version = "2013")] + void TestMethod12() + { + Assert.Equal("12.0", DteUtilities.GetVsVersion()); + } + + [VsFact(Version = "2015")] + void TestMethod14() + { + Assert.Equal("14.0", DteUtilities.GetVsVersion()); + } + + [VsFact(Version = "2017")] + void TestMethod15() + { + Assert.Equal("15.0", DteUtilities.GetVsVersion()); + } + + [VsFact(Version = "2019")] + void TestMethod16() + { + Assert.Equal("16.0", DteUtilities.GetVsVersion()); + } + } +} diff --git a/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary.Tests/VsClassLibrary.Tests.csproj b/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary.Tests/VsClassLibrary.Tests.csproj new file mode 100644 index 0000000..a5c4c9d --- /dev/null +++ b/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary.Tests/VsClassLibrary.Tests.csproj @@ -0,0 +1,17 @@ + + + net461 + x86 + + + + + + + + + + + + + \ No newline at end of file diff --git a/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary.sln b/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary.sln new file mode 100644 index 0000000..fac1500 --- /dev/null +++ b/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.539 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VsClassLibrary", "VsClassLibrary\VsClassLibrary.csproj", "{1E5F4A25-F9F5-43C5-87D0-B835C556253C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VsClassLibrary.Tests", "VsClassLibrary.Tests\VsClassLibrary.Tests.csproj", "{7E166B80-8DA2-4115-BDCC-C70B836631E7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1E5F4A25-F9F5-43C5-87D0-B835C556253C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E5F4A25-F9F5-43C5-87D0-B835C556253C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E5F4A25-F9F5-43C5-87D0-B835C556253C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E5F4A25-F9F5-43C5-87D0-B835C556253C}.Release|Any CPU.Build.0 = Release|Any CPU + {7E166B80-8DA2-4115-BDCC-C70B836631E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E166B80-8DA2-4115-BDCC-C70B836631E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E166B80-8DA2-4115-BDCC-C70B836631E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E166B80-8DA2-4115-BDCC-C70B836631E7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F63A3571-8096-4E56-98EB-535E31679F12} + EndGlobalSection +EndGlobal diff --git a/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary/DteUtilities.cs b/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary/DteUtilities.cs new file mode 100644 index 0000000..7a4cc35 --- /dev/null +++ b/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary/DteUtilities.cs @@ -0,0 +1,17 @@ +using EnvDTE; +using Microsoft; +using Microsoft.VisualStudio.Shell; + +namespace VsClassLibrary +{ + public class DteUtilities + { + public static string GetVsVersion() + { + ThreadHelper.ThrowIfNotOnUIThread(); + var dte = (DTE)ServiceProvider.GlobalProvider.GetService(typeof(DTE)); + Assumes.Present(dte); + return dte.Version; + } + } +} diff --git a/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary/VsClassLibrary.csproj b/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary/VsClassLibrary.csproj new file mode 100644 index 0000000..df83648 --- /dev/null +++ b/VsixTestingSamples-master/VsClassLibrary/VsClassLibrary/VsClassLibrary.csproj @@ -0,0 +1,13 @@ + + + + net461 + + + + + 14.0.81-pre + + + + diff --git a/VsixTestingSamples-master/azure-pipelines.yml b/VsixTestingSamples-master/azure-pipelines.yml new file mode 100644 index 0000000..d4c20bd --- /dev/null +++ b/VsixTestingSamples-master/azure-pipelines.yml @@ -0,0 +1,14 @@ +pool: + vmImage: 'vs2017-win2016' + +steps: +- task: NuGetCommand@2 + inputs: + command: 'restore' + restoreSolution: '**/*.sln' + +- task: VSBuild@1 + inputs: + solution: '**\*.sln' + msbuildArgs: '/p:DeployExtension=false' + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6d41783..09bb29a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,25 +10,23 @@ pool: vmImage: 'windows-latest' variables: - solution: '**/*.sln' + solution: '**/VsAsyncPackage.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' steps: -- task: NuGetToolInstaller@1 - - task: NuGetCommand@2 inputs: - restoreSolution: '$(solution)' + command: 'restore' + restoreSolution: 'VsixTestingSamples-master\VsAsyncPackage\VsAsyncPackage.sln' - task: VSBuild@1 inputs: - solution: '$(solution)' - msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' + solution: 'VsixTestingSamples-master\VsAsyncPackage\VsAsyncPackage.sln' - task: VSTest@2 inputs: - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' + testAssemblyVer2: | # Required when testSelector == TestAssemblies + **\VsAsyncPackage.Tests.dll + !**\*TestAdapter.dll + !**\obj\** \ No newline at end of file