Пример #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);
            }
        }
Пример #2
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);
        }