/// <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 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);
        }
        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");
        }
 private static string TargetInstallationPath(string vsVersion)
 {
     return(VisualStudioOptions.GetVisualizerDestinationFolder(vsVersion));
 }