Beispiel #1
0
        /// <inheritdoc />
        /// <summary>
        ///     Executes an ITask. It creates a DynamicDebuggerVisualizer mapping all the types of a given assembly
        /// </summary>
        /// <returns>
        ///     true if the task executed successfully; otherwise, false.
        /// </returns>
        public bool Execute()
        {
            try
            {
                Log.Configure("LINQBridgeVs", "MapperBuildTask");

                //this is where the current assembly being built is saved
                string currentBuildingFolder  = Path.GetDirectoryName(Assembly);
                string targetInstallationPath = VisualStudioOptions.GetVisualizerDestinationFolder(VisualStudioVer);

                Log.Write("Installation Path {0}", targetInstallationPath);

                //it gets the source path for the visualizer to use (usually from the extension directory)
                //usually from the folder where the extension is installed (BridgeVs.DynamicVisualizer.V1x)
                string dynamicVisualizerSourceAssemblyPath = VisualStudioOptions.GetVisualizerAssemblyLocation(VisualStudioVer);

                //if dot net visualizer exists already don't create it again
                if (!File.Exists(Path.Combine(targetInstallationPath, DotNetVisualizerAssemblyName)))
                {
                    //it creates a mapping for all of the .net types that are worth exporting
                    CreateDotNetFrameworkVisualizer(currentBuildingFolder, targetInstallationPath, dynamicVisualizerSourceAssemblyPath);
                }

                CreateDebuggerVisualizer(targetInstallationPath, dynamicVisualizerSourceAssemblyPath);

                return(true);
            }
            catch (Exception e)
            {
                Log.Write(e, @"Error Executing MSBuild Task MapperBuildTask ");
                return(false);
            }
        }
        public void when_parsing_nickname_argument_then_nickname_is_set(string argument, string expectedValue)
        {
            var options = VisualStudioOptions.Empty().WithNickname();

            options.Parse(new[] { argument });

            Assert.Equal(expectedValue, options.Nickname);
        }
        public void when_parsing_sku_argument_then_sku_is_set(string argument, Sku?expectedValue)
        {
            var options = VisualStudioOptions.Empty().WithSku();

            options.Parse(new[] { argument });

            Assert.Equal(expectedValue, options.Sku);
        }
        public void when_parsing_channel_argument_then_channel_is_set(string argument, Channel?expectedValue)
        {
            var options = VisualStudioOptions.Empty().WithChannel();

            options.Parse(new[] { argument });

            Assert.Equal(expectedValue, options.Channel);
        }
        public void when_parsing_all_argument_then_all_is_set(string argument, bool expectedValue)
        {
            var options = VisualStudioOptions.Empty().WithSelectAll();

            options.Parse(new[] { argument });

            Assert.Equal(expectedValue, options.All);
        }
        public void when_parsing_expression_then_exppression_is_set(string argument, string expectedValue)
        {
            var options = VisualStudioOptions.Empty().WithFilter();

            options.Parse(new[] { argument });

            Assert.Equal(expectedValue, options.Expression);
        }
        public void when_parsing_experimental_then_experimental_is_set(string argument, bool expectedValue)
        {
            var options = VisualStudioOptions.Empty().WithExperimental();

            options.Parse(new[] { argument });

            Assert.Equal(expectedValue, options.IsExperimental);
        }
Beispiel #8
0
        public bool Execute()
        {
            string visualizerAssemblyName = VisualizerAssemblyNameFormat.GetTargetVisualizerAssemblyName(VisualStudioVer, Assembly);
            string targetInstallationPath = VisualStudioOptions.GetVisualizerDestinationFolder(VisualStudioVer);

            string visualizerFullPath = Path.Combine(targetInstallationPath, visualizerAssemblyName);

            if (File.Exists(visualizerFullPath))
            {
                File.Delete(visualizerFullPath);
            }

            //check if pdb also exists and delete it
            string visualizerPdbFullPath = visualizerFullPath.Replace(".dll", ".pdb");

            if (File.Exists(visualizerPdbFullPath))
            {
                File.Delete(visualizerPdbFullPath);
            }

            return(true);
        }
Beispiel #9
0
        public void Clean_BuildTask_Test_V12_Should_Succeed()
        {
            const string vsVersion = "12.0";
            string       visualizerAssemblyName = VisualizerAssemblyNameFormat.GetTargetVisualizerAssemblyName(vsVersion, _assemblyModel.Location);
            string       targetInstallationPath = VisualStudioOptions.GetVisualizerDestinationFolder(vsVersion);
            string       visualizerFullPath     = Path.Combine(targetInstallationPath, visualizerAssemblyName);
            string       visualizerPdbFullPath  = visualizerFullPath.Replace(".dll", ".pdb");

            CreateDllAndPdb(visualizerFullPath, visualizerPdbFullPath);

            CleanBuildTask cleanBuildTask = new CleanBuildTask
            {
                Assembly        = _assemblyModel.Location,
                VisualStudioVer = vsVersion
            };

            bool result = cleanBuildTask.Execute();

            Assert.IsTrue(result, $"Clean build task V{vsVersion} failed");
            Assert.IsFalse(File.Exists(visualizerFullPath), $"{visualizerFullPath} hasn't been deleted correctly");
            Assert.IsFalse(File.Exists(visualizerPdbFullPath), $"{visualizerPdbFullPath} hasn't been deleted correctly");
        }
Beispiel #10
0
        /// <summary>
        ///     Executes an ITask. It creates a DynamicDebuggerVisualizer mapping all the types of a given assembly
        /// </summary>
        /// <returns>
        ///     true if the task executed successfully; otherwise, false.
        /// </returns>
        public bool Execute()
        {
            try
            {
                Log.Configure("LINQBridgeVs", "MapperBuildTask");

                var installationPaths = VisualStudioOptions.GetInstallationPath(VisualStudioVer).ToList();

                Log.Write("Installation Paths {0}", string.Join(",", installationPaths.ToArray()));

                var visualizerAssemblyLocation = VisualStudioOptions.GetVisualizerAssemblyLocation(VisualStudioVer);

                Log.Write("Visualizer Assembly location {0}", visualizerAssemblyLocation);

                VisualizerTypeMapper.MapDotNetFrameworkTypes(installationPaths, VisualStudioVer,
                                                             visualizerAssemblyLocation);

                var typeMapper = new VisualizerTypeMapper(visualizerAssemblyLocation);

                typeMapper.MapAssembly(Assembly);

                typeMapper.Save(installationPaths, VisualizerAssemblyName);

                Log.Write("Assembly {0} Mapped", Assembly);


                return(true);
            }
            catch (Exception e)
            {
                Log.Write(e, @"Error Executing MSBuild Task MapperBuildTask ");
            }



            return(true);
        }
Beispiel #11
0
 private static string TargetInstallationPath(string vsVersion)
 {
     return(VisualStudioOptions.GetVisualizerDestinationFolder(vsVersion));
 }