diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.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/CommonSolutionTargets/CommonSolutionTargets.sln b/CommonSolutionTargets/CommonSolutionTargets.sln new file mode 100644 index 0000000..df3eccb --- /dev/null +++ b/CommonSolutionTargets/CommonSolutionTargets.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonSolutionTargets", "CommonSolutionTargets\CommonSolutionTargets.csproj", "{8FFB054D-F81F-4D2A-B32F-29586E12726D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8FFB054D-F81F-4D2A-B32F-29586E12726D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FFB054D-F81F-4D2A-B32F-29586E12726D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FFB054D-F81F-4D2A-B32F-29586E12726D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FFB054D-F81F-4D2A-B32F-29586E12726D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/CommonSolutionTargets/CommonSolutionTargets/BuildType.cs b/CommonSolutionTargets/CommonSolutionTargets/BuildType.cs new file mode 100644 index 0000000..adedc1b --- /dev/null +++ b/CommonSolutionTargets/CommonSolutionTargets/BuildType.cs @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2013-2014 Denis Kuzmin (reg) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . +*/ + +using System; +using Microsoft.VisualStudio; + +namespace CommonSolutionTargets +{ + /// + /// Represents available types of the build for any actions + /// + /// *!* be careful with intersection + /// Scope of: + /// * {5EFC7975-14BC-11CF-9B2B-00AA00573819} + /// * {1496A755-94DE-11D0-8C3F-00C04FC2AAE2} + /// + public enum BuildType + { + /// + /// 'build' action + /// + Build = VSConstants.VSStd97CmdID.BuildSln, + /// + /// 'rebuild' action + /// + Rebuild = VSConstants.VSStd97CmdID.RebuildSln, + /// + /// 'clean' action + /// + Clean = VSConstants.VSStd97CmdID.CleanSln, + /// + /// 'deploy' action + /// + Deploy = VSConstants.VSStd97CmdID.DeploySln, + /// + /// 'Start Debugging' action + /// + Start = VSConstants.VSStd97CmdID.Start, + /// + /// 'Start Without Debugging' action + /// + StartNoDebug = VSConstants.VSStd97CmdID.StartNoDebug, + + /// + /// 'build' action for selection + /// + BuildSelection = VSConstants.VSStd97CmdID.BuildSel, + /// + /// 'rebuild' action for selection + /// + RebuildSelection = VSConstants.VSStd97CmdID.RebuildSel, + /// + /// 'clean' action for selection + /// + CleanSelection = VSConstants.VSStd97CmdID.CleanSel, + /// + /// 'deploy' action for selection + /// + DeploySelection = VSConstants.VSStd97CmdID.DeploySel, + + /// + /// 'build' action for project + /// + BuildOnlyProject = VSConstants.VSStd2KCmdID.BuildOnlyProject, + /// + /// 'rebuild' action for project + /// + RebuildOnlyProject = VSConstants.VSStd2KCmdID.RebuildOnlyProject, + /// + /// 'clean' action for project + /// + CleanOnlyProject = VSConstants.VSStd2KCmdID.CleanOnlyProject, + + /// + /// 'build' action for project + /// + BuildCtx = VSConstants.VSStd97CmdID.BuildCtx, + /// + /// 'rebuild' action for project + /// + RebuildCtx = VSConstants.VSStd97CmdID.RebuildCtx, + /// + /// 'clean' action for project + /// + CleanCtx = VSConstants.VSStd97CmdID.CleanCtx, + /// + /// 'deploy' action for project + /// + DeployCtx = VSConstants.VSStd97CmdID.DeployCtx, + + /// + /// 'Compile' action + /// + Compile = VSConstants.VSStd2KCmdID.COMPILE, + /// + /// 'Link only' action + /// + LinkOnly = VSConstants.VSStd2KCmdID.LINKONLY, + /// + /// 'Publish' action for selection + /// + PublishSelection = VSConstants.VSStd2KCmdID.ECMD_PUBLISHSELECTION, + + /// + /// Common context + /// + Common = Int32.MaxValue + } +} diff --git a/CommonSolutionTargets/CommonSolutionTargets/CommonSolutionTargets.cs b/CommonSolutionTargets/CommonSolutionTargets/CommonSolutionTargets.cs new file mode 100644 index 0000000..c5971ac --- /dev/null +++ b/CommonSolutionTargets/CommonSolutionTargets/CommonSolutionTargets.cs @@ -0,0 +1,358 @@ +//------------------------------------------------------------------------------ +// +// Copyright (c) Company. All rights reserved. +// +//------------------------------------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using EnvDTE; +using EnvDTE80; +using Microsoft.Build.Evaluation; +using Microsoft.Build.Execution; +using Microsoft.Build.Framework; +using Microsoft.Build.Logging; +using Microsoft.VisualStudio; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; + +namespace CommonSolutionTargets +{ + /// + /// This is the class that implements the package exposed by this assembly. + /// + /// + /// + /// The minimum requirement for a class to be considered a valid package for Visual Studio + /// is to implement the IVsPackage interface and register itself with the shell. + /// This package uses the helper classes defined inside the Managed Package Framework (MPF) + /// to do it: it derives from the Package class that provides the implementation of the + /// IVsPackage interface and uses the registration attributes defined in the framework to + /// register itself and its components with the shell. These attributes tell the pkgdef creation + /// utility what data to put into .pkgdef file. + /// + /// + /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file. + /// + /// + [PackageRegistration(UseManagedResourcesOnly = true)] + [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About + [Guid(CommonSolutionTargets.PackageGuidString)] + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] + [ProvideAutoLoad(UIContextGuids.SolutionExists)] + public sealed class CommonSolutionTargets : Package, IVsUpdateSolutionEvents + { + /// + /// CommonSolutionTargets GUID string. + /// + public const string PackageGuidString = "b49988b3-37f1-4195-b984-c64b4885432c"; + + private DTE2 dte2; + private IVsSolutionBuildManager2 solutionBuildManager; + private uint updateSolutionEventsCookie; + IVsOutputWindowPane buildOutputWindowPane; + + private CommandEvents commandEvents; + private string VSStd97CmdIDGuid; + private string VSStd2KCmdIDGuid; + private string activeBuildTarget; + + private LoggerVerbosity currentLoggerVerbosity = LoggerVerbosity.Minimal; + + /// + /// Default constructor of the package. + /// Inside this method you can place any initialization code that does not require + /// any Visual Studio service because at this point the package object is created but + /// not sited yet inside Visual Studio environment. The place to do all the other + /// initialization is the Initialize method. + /// + public CommonSolutionTargets() + { + Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this)); + } + + + + ///////////////////////////////////////////////////////////////////////////// + // Overridden Package Implementation + #region Package Members + + /// + /// Initialization of the package; this method is called right after the package is sited, so this is the place + /// where you can put all the initialization code that rely on services provided by VisualStudio. + /// + protected override void Initialize() + { + Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this)); + base.Initialize(); + + this.dte2 = this.GetService(typeof(SDTE)) as DTE2; + if (this.dte2 == null) + { + Log.LogError("VSPackage.Initialize() could not obtain DTE2 reference"); + return; + } + + this.RefreshMSBuildOutputVerbositySetting(); + + // Get solution build manager + this.solutionBuildManager = ServiceProvider.GlobalProvider.GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager2; + if (this.solutionBuildManager != null) + { + this.solutionBuildManager.AdviseUpdateSolutionEvents(this, out this.updateSolutionEventsCookie); + } + + IVsOutputWindow outputWindow = this.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow; + if (outputWindow == null) + { + Log.LogError("VSPackage.Initialize() could not obtain IVsOutputWindow reference"); + return; + } + + Guid buildPaneGuid = VSConstants.GUID_BuildOutputWindowPane; + int hResult = outputWindow.GetPane(ref buildPaneGuid, out this.buildOutputWindowPane); + if (hResult != VSConstants.S_OK || this.buildOutputWindowPane == null) + { + Log.LogError("VSPackage.Initialize() could not obtain IVsOutputWindowPane reference"); + return; + } + + GuidAttribute VSStd97CmdIDGuidAttribute = typeof(VSConstants.VSStd97CmdID).GetCustomAttributes(typeof(GuidAttribute), true)[0] as GuidAttribute; + Debug.Assert(VSStd97CmdIDGuidAttribute != null, "VSStd97CmdIDGuidAttribute != null"); + this.VSStd97CmdIDGuid = "{" + VSStd97CmdIDGuidAttribute.Value + "}"; + + GuidAttribute VSStd2KCmdIDGuidAttribute = typeof(VSConstants.VSStd2KCmdID).GetCustomAttributes(typeof(GuidAttribute), true)[0] as GuidAttribute; + Debug.Assert(VSStd2KCmdIDGuidAttribute != null, "VSStd2KCmdIDGuidAttribute != null"); + this.VSStd2KCmdIDGuid = "{" + VSStd2KCmdIDGuidAttribute.Value + "}"; + + this.commandEvents = this.dte2.Events.CommandEvents; + this.commandEvents.BeforeExecute += this.CommandEvents_BeforeExecute; + + } + + void CommandEvents_BeforeExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) + { + if (!Guid.Equals(this.VSStd97CmdIDGuid, StringComparison.OrdinalIgnoreCase) && + !Guid.Equals(this.VSStd2KCmdIDGuid, StringComparison.OrdinalIgnoreCase)) + return; + + //Debug.WriteLine("ID= " + ID); + switch (ID) + { + case (int)BuildType.Build: + case (int)BuildType.BuildSelection: + case (int)BuildType.BuildOnlyProject: + case (int)BuildType.BuildCtx: + this.activeBuildTarget = "Build"; + break; + case (int)BuildType.Rebuild: + case (int)BuildType.RebuildSelection: + case (int)BuildType.RebuildOnlyProject: + case (int)BuildType.RebuildCtx: + this.activeBuildTarget = "Rebuild"; + break; + case (int)BuildType.Clean: + case (int)BuildType.CleanSelection: + case (int)BuildType.CleanOnlyProject: + case (int)BuildType.CleanCtx: + this.activeBuildTarget = "Clean"; + break; + case (int)BuildType.Deploy: + case (int)BuildType.DeploySelection: + case (int)BuildType.DeployCtx: + this.activeBuildTarget = "Deploy"; + break; + } + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + // Unadvise all events + if (this.solutionBuildManager != null && this.updateSolutionEventsCookie != 0) + this.solutionBuildManager.UnadviseUpdateSolutionEvents(this.updateSolutionEventsCookie); + } + #endregion + + #region Implementation of IVsUpdateSolutionEvents + + /// + /// Called before any build actions have begun. This is the last chance to cancel the build before any building begins. + /// + /// + /// If the method succeeds, it returns . If it fails, it returns an error code. + /// + /// [in, out] Pointer to a flag indicating cancel update. + int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) + { + this.WriteLine(LoggerVerbosity.Diagnostic, "CommonSolutionTargets UpdateSolution_Begin"); + return 0; + } + + /// + /// Called when a build is completed. + /// + /// + /// If the method succeeds, it returns . If it fails, it returns an error code. + /// + /// [in] true if no update actions failed.[in] true if any update action succeeded.[in] true if update actions were canceled. + int IVsUpdateSolutionEvents.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) + { + // This method is called when a build is completed. + this.WriteLine(LoggerVerbosity.Detailed, "CommonSolutionTargets: UpdateSolution_Done"); + + this.activeBuildTarget = null; + return 0; + } + + /// + /// Called before the first project configuration is about to be built. + /// + /// + /// If the method succeeds, it returns . If it fails, it returns an error code. + /// + /// [in, out] Pointer to a flag indicating cancel update. + int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) + { + // This method is called when the entire solution starts to build. + this.WriteLine(LoggerVerbosity.Detailed, "CommonSolutionTargets: UpdateSolution_StartUpdate"); + + string solutionFilePath = this.dte2.Solution.FullName; + string solutionFolder = Path.GetDirectoryName(solutionFilePath); + string solutionFileName = Path.GetFileName(solutionFilePath); + string targetsFileName = "after." + solutionFileName + ".targets"; + if (solutionFolder == null) + return VSConstants.E_UNEXPECTED; + + string targetsFilePath = Path.Combine(solutionFolder, targetsFileName); + + if (!File.Exists(targetsFilePath)) + return VSConstants.S_OK; + + string solutionConfigurationName = this.dte2.Solution.SolutionBuild.ActiveConfiguration.Name; + this.WriteLine(LoggerVerbosity.Detailed, "CommonSolutionTargets: active solution configuration name is \"{0}\"", solutionConfigurationName); + + List loggers = new List { this.MakeBuildLogger() }; + + ProjectInstance solutionInitProjectInstance; + try + { + solutionInitProjectInstance = new ProjectInstance(targetsFilePath); + } + catch (Exception ex) + { + this.WriteLine(LoggerVerbosity.Detailed, "CommonSolutionTargets: failed to load targets file \"{0}\", Exception: {1}", targetsFilePath, ex); + return VSConstants.E_FAIL; + } + solutionInitProjectInstance.SetProperty("Configuration", solutionConfigurationName); + solutionInitProjectInstance.SetProperty("BuildingInsideVisualStudio", "true"); + int numberOfPropertiesBeforeBuild = solutionInitProjectInstance.Properties.Count; + this.WriteLine(LoggerVerbosity.Detailed, "CommonSolutionTargets: building targets file \"{0}\", target \"{1}\"", targetsFilePath, this.activeBuildTarget); + solutionInitProjectInstance.Build(this.activeBuildTarget, loggers); + + // If solution targets build produced new custom properties, fetch those and add them to the global properties collection. + // Most typical usage for this feature is setting "CustomAfterMicrosoftCommontargets" property. + for (int propertyNumber = numberOfPropertiesBeforeBuild; + propertyNumber < solutionInitProjectInstance.Properties.Count; + propertyNumber++) + { + ProjectPropertyInstance property = solutionInitProjectInstance.Properties.ElementAt(propertyNumber); + if (property.Name.StartsWith("Custom")) + { + this.WriteLine(LoggerVerbosity.Detailed, "CommonSolutionTargets: defined global build property {0} = {1}", property.Name, property.EvaluatedValue); + ProjectCollection.GlobalProjectCollection.SetGlobalProperty(property.Name, property.EvaluatedValue); + } + } + + return VSConstants.S_OK; + } + + /// + /// Called when a build is being cancelled. + /// + int IVsUpdateSolutionEvents.UpdateSolution_Cancel() + { + return 0; + } + + /// + /// Called when the active project configuration for a project in the solution has changed. + /// + /// + /// If the method succeeds, it returns . If it fails, it returns an error code. + /// + /// [in] Pointer to an object. + int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) + { + this.WriteLine(LoggerVerbosity.Detailed, "CommonSolutionTargets: OnActiveProjectCfgChange"); + return 0; + } + + #endregion + + /// + /// Outputs a message to the debug output pane, if the VS MSBuildOutputVerbosity + /// setting value is greater than or equal to the given verbosity. So if verbosity is 0, + /// it means the message is always written to the output pane. + /// + /// The verbosity level. + /// The format string. + /// An array of objects to write using format. + private void WriteLine(LoggerVerbosity verbosity, string format, params object[] args) + { + if (this.buildOutputWindowPane == null) + return; + + if ((int)this.currentLoggerVerbosity < (int)verbosity) + return; + + + this.buildOutputWindowPane.OutputString(string.Format(format + Environment.NewLine, args)); + } + + private ILogger MakeBuildLogger() + { + this.RefreshMSBuildOutputVerbositySetting(); + this.WriteLine(LoggerVerbosity.Diagnostic, "CommonSolutionTargets: creating build logger with verbosity {0}", this.currentLoggerVerbosity); + return new IDEBuildLogger(this.buildOutputWindowPane, this.currentLoggerVerbosity); + } + + /// + /// Refreshes the value of the VisualStudio MSBuildOutputVerbosity setting. + /// + /// + /// 0 is Quiet, while 4 is diagnostic. + /// + private void RefreshMSBuildOutputVerbositySetting() + { + Properties properties = this.dte2.Properties["Environment", "ProjectsAndSolution"]; + this.currentLoggerVerbosity = (LoggerVerbosity)properties.Item("MSBuildOutputVerbosity").Value; + } + } + + internal class IDEBuildLogger : ConsoleLogger + { + private IVsOutputWindowPane BuildOutputWindowPane { get; set; } + internal IDEBuildLogger(IVsOutputWindowPane buildOutputWindowPane, LoggerVerbosity verbosity) + { + this.BuildOutputWindowPane = buildOutputWindowPane; + this.WriteHandler = this.WriteToOutputWindowBuildPane; + + this.ShowSummary = false; + this.SkipProjectStartedText = true; + this.Verbosity = verbosity; + } + + private void WriteToOutputWindowBuildPane(string message) + { + this.BuildOutputWindowPane.OutputString(message); + } + } +} diff --git a/CommonSolutionTargets/CommonSolutionTargets/CommonSolutionTargets.csproj b/CommonSolutionTargets/CommonSolutionTargets/CommonSolutionTargets.csproj new file mode 100644 index 0000000..2e32206 --- /dev/null +++ b/CommonSolutionTargets/CommonSolutionTargets/CommonSolutionTargets.csproj @@ -0,0 +1,198 @@ + + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + true + + + true + + + Key.snk + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {8FFB054D-F81F-4D2A-B32F-29586E12726D} + Library + Properties + CommonSolutionTargets + CommonSolutionTargets + v4.5.2 + true + true + true + true + true + false + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + Designer + + + + + + + + + + False + + + False + + + False + + + False + + + + + + False + + + ..\packages\Microsoft.VisualStudio.Imaging.14.1.24720\lib\net45\Microsoft.VisualStudio.Imaging.dll + True + + + ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.14.0.14.1.24720\lib\Microsoft.VisualStudio.Shell.14.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Immutable.11.0.11.0.50727\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Immutable.12.0.12.0.21003\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Immutable.14.0.14.1.24720\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30319\lib\Microsoft.VisualStudio.Shell.Interop.10.0.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61030\lib\Microsoft.VisualStudio.Shell.Interop.11.0.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30110\lib\Microsoft.VisualStudio.Shell.Interop.12.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll + True + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll + True + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Threading.14.1.111\lib\net45\Microsoft.VisualStudio.Threading.dll + True + + + ..\packages\Microsoft.VisualStudio.Utilities.14.1.24720\lib\net45\Microsoft.VisualStudio.Utilities.dll + True + + + ..\packages\Microsoft.VisualStudio.Validation.14.1.111\lib\net45\Microsoft.VisualStudio.Validation.dll + True + + + False + + + + + + + + + + + true + VSPackage + + + + + + + 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/CommonSolutionTargets/CommonSolutionTargets/Key.snk b/CommonSolutionTargets/CommonSolutionTargets/Key.snk new file mode 100644 index 0000000..fffcadb Binary files /dev/null and b/CommonSolutionTargets/CommonSolutionTargets/Key.snk differ diff --git a/CommonSolutionTargets/CommonSolutionTargets/Log.cs b/CommonSolutionTargets/CommonSolutionTargets/Log.cs new file mode 100644 index 0000000..3e753ef --- /dev/null +++ b/CommonSolutionTargets/CommonSolutionTargets/Log.cs @@ -0,0 +1,21 @@ +using System.Diagnostics; + +namespace CommonSolutionTargets +{ + internal static class Log + { + internal static void LogError(string message) + { + try + { + // I'm co-opting the Visual Studio event source because I can't register my own from a .VSIX installer. + EventLog.WriteEntry("Microsoft Visual Studio", "VSSolutionTargets: " + (message ?? "null"), EventLogEntryType.Error); + } + catch + { + // Don't kill extension for logging errors + } + } + } +} + diff --git a/CommonSolutionTargets/CommonSolutionTargets/Properties/AssemblyInfo.cs b/CommonSolutionTargets/CommonSolutionTargets/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e6c1d13 --- /dev/null +++ b/CommonSolutionTargets/CommonSolutionTargets/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("CommonSolutionTargets")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CommonSolutionTargets")] +[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/CommonSolutionTargets/CommonSolutionTargets/Resources/CommonSolutionTargets.ico b/CommonSolutionTargets/CommonSolutionTargets/Resources/CommonSolutionTargets.ico new file mode 100644 index 0000000..d323b07 Binary files /dev/null and b/CommonSolutionTargets/CommonSolutionTargets/Resources/CommonSolutionTargets.ico differ diff --git a/CommonSolutionTargets/CommonSolutionTargets/VSPackage.resx b/CommonSolutionTargets/CommonSolutionTargets/VSPackage.resx new file mode 100644 index 0000000..27efa3a --- /dev/null +++ b/CommonSolutionTargets/CommonSolutionTargets/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 + + + + CommonSolutionTargets Extension + + + CommonSolutionTargets Visual Studio Extension Detailed Info + + + Resources\CommonSolutionTargets.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/CommonSolutionTargets/CommonSolutionTargets/index.html b/CommonSolutionTargets/CommonSolutionTargets/index.html new file mode 100644 index 0000000..947b054 --- /dev/null +++ b/CommonSolutionTargets/CommonSolutionTargets/index.html @@ -0,0 +1,65 @@ + + + + + + + + Getting Started + + + +
+ + +
+
+

Creating a Visual Studio Extension

+ +

This project enables developers to create an extension for Visual Studio. The solution contains a VSIX project that packages the extension into a VSIX file. This file is used to install an extension for Visual Studio.

+

Add new features

+ +
    +
  1. Right-click the project node in Solution Explorer and select Add>New Item.
  2. +
  3. In the Add New Item dialog box, expand the Extensibility node under Visual C# or Visual Basic.
  4. +
  5. Choose from the available item templates: Visual Studio Package, Editor Items (Classifier, Margin, Text Adornment, Viewport Adornment), Command, Tool Window, Toolbox Control, and then click Add.
  6. +
+ +

The files for the template that you selected are added to the project. You can start adding functionality to your item template, press F5 to run the project, or add additional item templates.

+ +

Run and debug

+

To run the project, press F5. Visual Studio will:

+ +
    +
  • Build the extension from the VSIX project.
  • +
  • Create a VSIX package from the VSIX project.
  • +
  • When debugging, start an experimental instance of Visual Studio with the VSIX package installed.
  • +
+ +

In the experimental instance of Visual Studio you can test out the functionality of your extension without affecting your Visual Studio installation.

+ +
+
+
+

Visual Studio Extensibility Resources

+ +
    +
  1. MSDN documentation
    Detailed documentation and API reference material for building extensions.
  2. +
  3. Extension samples on GitHub
    Use a sample project to kickstart your development.
  4. +
  5. Extensibility chat room on Gitter
    Meet other extension developers and exchange tips and tricks for extension development.
  6. +
  7. Channel 9 videos on extensibility
    Watch videos from the product team on Visual Studio extensibility.
  8. +
  9. Extensibility Tools 2015
    Install an optional helper tool that adds extra IDE support for extension authors.
  10. +
+

Give us feedback

+ +
+
+
+
+ + diff --git a/CommonSolutionTargets/CommonSolutionTargets/packages.config b/CommonSolutionTargets/CommonSolutionTargets/packages.config new file mode 100644 index 0000000..a68ec06 --- /dev/null +++ b/CommonSolutionTargets/CommonSolutionTargets/packages.config @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CommonSolutionTargets/CommonSolutionTargets/source.extension.vsixmanifest b/CommonSolutionTargets/CommonSolutionTargets/source.extension.vsixmanifest new file mode 100644 index 0000000..d555a94 --- /dev/null +++ b/CommonSolutionTargets/CommonSolutionTargets/source.extension.vsixmanifest @@ -0,0 +1,20 @@ + + + + + CommonSolutionTargets + Place a targets file named "after.<SolutionName>.sln.targets " near your solution file (.sln) and it will be invoked every time Visual Studio starts building your solution. This is very convenient for global MSBuild properties, common fragments for all project files and any pre build activity. + + + + + + + + + + + + + + diff --git a/CommonSolutionTargets/CommonSolutionTargets/stylesheet.css b/CommonSolutionTargets/CommonSolutionTargets/stylesheet.css new file mode 100644 index 0000000..d5e9c71 --- /dev/null +++ b/CommonSolutionTargets/CommonSolutionTargets/stylesheet.css @@ -0,0 +1,129 @@ +body { + margin: 0; + padding: 0; + border: 0; + color: #1E1E1E; + font-size: 13px; + font-family: "Segoe UI", Helvetica, Arial, sans-serif; + line-height: 1.45; + word-wrap: break-word; +} + +/* General & 'Reset' Stuff */ + + +.container { + width: 980px; + margin: 0 auto; +} + +section { + display: block; + margin: 0; +} + +h1, h2, h3, h4, h5, h6 { + margin: 0; +} + +/* Header,
+ header - container + h1 - project name + h2 - project description +*/ + +#header { + color: #FFF; + background: #68217a; + position:relative; +} +#hangcloud { + width: 190px; + height: 160px; + background: url("../images/bannerart03.png"); + position: absolute; + top: 0; + right: -30px; +} +h1, h2 { + font-family: "Segoe UI Light", "Segoe UI", Helvetica, Arial, sans-serif; + line-height: 1; + margin: 0 18px; + padding: 0; +} +#header h1 { + font-size: 3.4em; + padding-top: 18px; + font-weight: normal; + margin-left: 15px; +} + +#header h2 { + font-size: 1.5em; + margin-top: 10px; + padding-bottom: 18px; + font-weight: normal; +} + + +#main_content { + width: 100%; + display: flex; + flex-direction: row; +} + + +h1, h2, h3, h4, h5, h6 { + font-weight: bolder; +} + +#main_content h1 { + font-size: 1.8em; + margin-top: 34px; +} + + #main_content h1:first-child { + margin-top: 30px; + } + +#main_content h2 { + font-size: 1.4em; + font-weight: bold; +} +p, ul { + margin: 11px 18px; +} + +#main_content a { + color: #06C; + text-decoration: none; +} +ul { + margin-top: 13px; + margin-left: 18px; + padding-left: 0; +} + ul li { + margin-left: 18px; + padding-left: 0; + } +#lpanel { + width: 620px; + float: left; +} +#rpanel ul { + list-style-type: none; + width: 300px; +} + #rpanel ul li { + line-height: 1.8em; + } +#rpanel { + background: #e7e7e7; + width: 360px; + float: right; +} + +#rpanel div { + width: 300px; +}