├── .gitignore ├── LICENSE ├── README.md └── src ├── Mono.Debugger.Sample.sln ├── Mono.Debugger.Sample ├── Key.snk ├── Mono.Debugger.Sample.csproj ├── MonoSampleDebuggableConfig.cs ├── MonoSampleDebuggerSession.cs ├── MonoSampleFlavoredProject.cs ├── MonoSamplePackage.cs ├── MonoSampleProjectFactory.cs ├── MonoSampleStartInfo.cs ├── NuGet.Config ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── Mono.png │ └── MonoSamplePackage.ico ├── VSPackage.resx ├── packages.config └── source.extension.vsixmanifest ├── MonoSampleProject ├── AssemblyInfo.cs ├── MonoSampleProject.csproj ├── MonoSampleProject.ico ├── MonoSampleProject.vstemplate ├── Program.cs ├── ProjectTemplate.csproj └── Properties │ └── AssemblyInfo.cs └── NuGet.Config /.gitignore: -------------------------------------------------------------------------------- 1 | .nuget 2 | .vs 3 | build 4 | bin 5 | obj 6 | src/packages 7 | *.nupkg 8 | *.lock.json 9 | *.nuget.props 10 | *.nuget.targets 11 | *.suo 12 | *.user 13 | *.cache 14 | *.log -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Xamarin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mono Debugger Visual Studio Extension Sample 2 | 3 | This repository contains a source sample that consumes the Mono debugger in a custom 4 | Visual Studio project flavor (that is, new kind of project you're creating). 5 | 6 | You can use this for scenarios where you embed the Mono runtime into your application 7 | (either locally in a Windows application) or on a remote mono application. 8 | 9 | The project is set up and configured to built and run from Visual Studio 2015, 10 | ready for deploying and testing into the Visual Studio 2015 Experimental instance. 11 | 12 | The resulting VSIX does work under VS2017 too, but in order to build and run from 13 | VS2017, a one-way upgrade will be performed by Visual Studio upon opening the project, 14 | and the `Microsoft.VSSDK.BuildTools` nuget package will be updated to the latest `15.*` 15 | version which can only deploy to Visual Studio 2017 Experimental instance instead. 16 | 17 | # How It Works 18 | 19 | The solution contains two projects: 20 | 21 | * Mono.Debugger.Sample: the actual Visual Studio extension that hooks up the debugger 22 | * MonoSampleProject: the source for a project template that users can "unfold" by 23 | doing File | New | MonoSampleProject in Visual Studio. 24 | 25 | The extension provides a new project template and accompanying custom project flavor. 26 | In order for VS to determine that our custom project needs to be initialized (and its 27 | containing package loaded), a .csproj must declare our custom flavor GUID as part of 28 | the `` element. This is provided in the 29 | [included project template](https://github.com/xamarin/vs-mono-debugger-sample/blob/master/src/MonoSampleProject/ProjectTemplate.csproj#L9) 30 | for eacy testing after hitting F5 on VS to try out the solution. 31 | 32 | This sample uses the "classic" project extensibility in Visual Studio. You can read 33 | more about it in the [Project Subtypes](https://msdn.microsoft.com/en-us/library/bb166488.aspx) 34 | section of the VSSDK documentation. 35 | 36 | 37 | # Customizing for Production 38 | 39 | At a minimum, you should rename all `MonoSample` instances with your own project name/prefix. 40 | 41 | Required changes before distribution, to avoid collisions with other projects based on this 42 | sample, are: 43 | 44 | * `MonoSamplePackage.PackageGuidString`: this is the extension package GUID, and should be your 45 | own unique value 46 | * `MonoSamplePackage.MonoSampleProjectGuid`: this is the project flavor GUID and should be your 47 | own unique value too. Update the value in `ProjectTemplate.csproj` to match. 48 | * `source.extension.vsixmanifest`: change the `Identity` element, in particular, the `Id` attribute. 49 | 50 | -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Debugger.Sample", "Mono.Debugger.Sample\Mono.Debugger.Sample.csproj", "{02DEE43F-F463-45E2-9A47-D4044FE0F740}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoSampleProject", "MonoSampleProject\MonoSampleProject.csproj", "{74CCF091-8EAB-4706-8CD2-357BCAE45C2A}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8D37CDB1-741D-4362-B294-1E6BC8853A5D}" 11 | ProjectSection(SolutionItems) = preProject 12 | ..\README.md = ..\README.md 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Release|Any CPU = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {02DEE43F-F463-45E2-9A47-D4044FE0F740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {02DEE43F-F463-45E2-9A47-D4044FE0F740}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {02DEE43F-F463-45E2-9A47-D4044FE0F740}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {02DEE43F-F463-45E2-9A47-D4044FE0F740}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {74CCF091-8EAB-4706-8CD2-357BCAE45C2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {74CCF091-8EAB-4706-8CD2-357BCAE45C2A}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {74CCF091-8EAB-4706-8CD2-357BCAE45C2A}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {74CCF091-8EAB-4706-8CD2-357BCAE45C2A}.Release|Any CPU.Build.0 = Release|Any CPU 29 | EndGlobalSection 30 | GlobalSection(SolutionProperties) = preSolution 31 | HideSolutionNode = FALSE 32 | EndGlobalSection 33 | EndGlobal 34 | -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/vs-mono-debugger-sample/e019cbe26eb9f476fbc0221d785a454d802089e6/src/Mono.Debugger.Sample/Key.snk -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/Mono.Debugger.Sample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 14.0 9 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 10 | true 11 | Program 12 | $(DevEnvDir)devenv.exe 13 | /rootSuffix Exp 14 | true 15 | Key.snk 16 | 17 | 18 | 19 | 20 | 21 | Debug 22 | AnyCPU 23 | 2.0 24 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 25 | {02DEE43F-F463-45E2-9A47-D4044FE0F740} 26 | Library 27 | Properties 28 | Mono.Debuggable.Sample 29 | Mono.Debuggable.Sample 30 | v4.5.2 31 | true 32 | true 33 | true 34 | true 35 | true 36 | false 37 | 38 | 39 | true 40 | full 41 | false 42 | bin\Debug\ 43 | DEBUG;TRACE 44 | prompt 45 | 4 46 | 47 | 48 | pdbonly 49 | true 50 | bin\Release\ 51 | TRACE 52 | prompt 53 | 4 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | Designer 68 | 69 | 70 | Designer 71 | 72 | 73 | 74 | 75 | Always 76 | true 77 | 78 | 79 | 80 | 81 | 82 | False 83 | ..\packages\VSSDK.DTE.7.0.4\lib\net20\envdte.dll 84 | True 85 | 86 | 87 | False 88 | 89 | 90 | False 91 | 92 | 93 | False 94 | 95 | 96 | ..\packages\Mono.Debugging.VisualStudio.4.7.21-pre\lib\net45\ICSharpCode.NRefactory.dll 97 | 98 | 99 | ..\packages\Mono.Debugging.VisualStudio.4.7.21-pre\lib\net45\ICSharpCode.NRefactory.CSharp.dll 100 | 101 | 102 | 103 | 104 | False 105 | 106 | 107 | ..\packages\Microsoft.VisualStudio.Imaging.14.3.25407\lib\net45\Microsoft.VisualStudio.Imaging.dll 108 | True 109 | 110 | 111 | ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll 112 | True 113 | 114 | 115 | ..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll 116 | True 117 | 118 | 119 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll 120 | True 121 | 122 | 123 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.11.0.11.0.50727\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll 124 | True 125 | 126 | 127 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.12.0.12.0.21003\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll 128 | True 129 | 130 | 131 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.14.0.14.3.25407\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll 132 | True 133 | 134 | 135 | ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll 136 | True 137 | 138 | 139 | True 140 | ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30319\lib\Microsoft.VisualStudio.Shell.Interop.10.0.dll 141 | True 142 | 143 | 144 | True 145 | ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61030\lib\Microsoft.VisualStudio.Shell.Interop.11.0.dll 146 | True 147 | 148 | 149 | True 150 | ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30110\lib\Microsoft.VisualStudio.Shell.Interop.12.0.dll 151 | True 152 | 153 | 154 | ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll 155 | True 156 | 157 | 158 | ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll 159 | True 160 | 161 | 162 | ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll 163 | True 164 | 165 | 166 | ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll 167 | True 168 | 169 | 170 | ..\packages\Microsoft.VisualStudio.Threading.14.1.111\lib\net45\Microsoft.VisualStudio.Threading.dll 171 | True 172 | 173 | 174 | ..\packages\Microsoft.VisualStudio.Utilities.14.3.25407\lib\net45\Microsoft.VisualStudio.Utilities.dll 175 | True 176 | 177 | 178 | ..\packages\Microsoft.VisualStudio.Validation.14.1.111\lib\net45\Microsoft.VisualStudio.Validation.dll 179 | True 180 | 181 | 182 | ..\packages\Mono.Debugging.VisualStudio.4.7.21-pre\lib\net45\Mono.Cecil.dll 183 | 184 | 185 | ..\packages\Mono.Debugging.VisualStudio.4.7.21-pre\lib\net45\Mono.Cecil.Mdb.dll 186 | 187 | 188 | ..\packages\Mono.Debugging.VisualStudio.4.7.21-pre\lib\net45\Mono.Cecil.Pdb.dll 189 | 190 | 191 | ..\packages\Mono.Debugging.VisualStudio.4.7.21-pre\lib\net45\Mono.Cecil.Rocks.dll 192 | 193 | 194 | ..\packages\Mono.Debugging.VisualStudio.4.7.21-pre\lib\net45\Mono.Debugger.Soft.dll 195 | 196 | 197 | ..\packages\Mono.Debugging.VisualStudio.4.7.21-pre\lib\net45\Mono.Debugging.dll 198 | 199 | 200 | ..\packages\Mono.Debugging.VisualStudio.4.7.21-pre\lib\net45\Mono.Debugging.Soft.dll 201 | 202 | 203 | ..\packages\Mono.Debugging.VisualStudio.4.7.21-pre\lib\net45\Mono.Debugging.VisualStudio.dll 204 | 205 | 206 | False 207 | ..\packages\VSSDK.DTE.7.0.4\lib\net20\stdole.dll 208 | True 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | true 220 | VSPackage 221 | Designer 222 | 223 | 224 | 225 | 226 | {74ccf091-8eab-4706-8cd2-357bcae45c2a} 227 | MonoSampleProject 228 | false 229 | Project 230 | ProjectTemplates 231 | TemplateProjectOutputGroup%3b 232 | 233 | 234 | 235 | 236 | 237 | 238 | 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}. 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/MonoSampleDebuggableConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.OLE.Interop; 3 | using Microsoft.VisualStudio.Shell.Interop; 4 | using System.Runtime.InteropServices; 5 | using Microsoft.VisualStudio; 6 | using Mono.Debugging.VisualStudio; 7 | using EnvDTE; 8 | using Mono.Debugging.Soft; 9 | using System.Net; 10 | 11 | namespace Mono.Debugger.Sample 12 | { 13 | internal class MonoSampleDebuggableConfig : IVsDebuggableProjectCfg, IVsProjectFlavorCfg 14 | { 15 | private IVsProjectFlavorCfg baseProjectCfg; 16 | private Project baseProject; 17 | 18 | public MonoSampleDebuggableConfig(IVsProjectFlavorCfg pBaseProjectCfg, EnvDTE.Project project) 19 | { 20 | this.baseProject = project; 21 | this.baseProjectCfg = pBaseProjectCfg; 22 | } 23 | 24 | public int Close() 25 | { 26 | if (baseProjectCfg != null) 27 | { 28 | baseProjectCfg.Close(); 29 | baseProjectCfg = null; 30 | } 31 | 32 | return VSConstants.S_OK; 33 | } 34 | 35 | public int DebugLaunch(uint grfLaunch) 36 | {//if launch with debug; else just run 37 | var random = new Random(DateTime.Now.Millisecond); 38 | var port = 8800 + random.Next(0, 100); 39 | 40 | var startArgs = new SoftDebuggerListenArgs(baseProject.Name, IPAddress.Loopback, port); 41 | 42 | var startInfo = new MonoSampleStartInfo(startArgs, null, baseProject); 43 | var session = new MonoSampleDebuggerSession(); 44 | 45 | var launcher = new MonoDebuggerLauncher(new Progress()); 46 | 47 | launcher.StartSession(startInfo, session); 48 | 49 | return VSConstants.S_OK; 50 | } 51 | 52 | public int QueryDebugLaunch(uint grfLaunch, out int pfCanLaunch) 53 | { 54 | pfCanLaunch = 1; 55 | return VSConstants.S_OK; 56 | } 57 | 58 | public int get_CfgType(ref Guid iidCfg, out IntPtr ppCfg) 59 | { 60 | ppCfg = IntPtr.Zero; 61 | 62 | try 63 | { 64 | if (iidCfg == typeof(IVsDebuggableProjectCfg).GUID) 65 | ppCfg = Marshal.GetComInterfaceForObject(this, typeof(IVsDebuggableProjectCfg)); 66 | else if ((ppCfg == IntPtr.Zero) && (this.baseProjectCfg != null)) 67 | return this.baseProjectCfg.get_CfgType(ref iidCfg, out ppCfg); 68 | } 69 | catch (InvalidCastException) 70 | { 71 | } 72 | 73 | return VSConstants.S_OK; 74 | } 75 | 76 | public int EnumOutputs(out IVsEnumOutputs ppIVsEnumOutputs) 77 | { 78 | throw new NotImplementedException(); 79 | } 80 | 81 | public int get_BuildableProjectCfg(out IVsBuildableProjectCfg ppIVsBuildableProjectCfg) 82 | { 83 | throw new NotImplementedException(); 84 | } 85 | 86 | public int get_CanonicalName(out string pbstrCanonicalName) 87 | { 88 | throw new NotImplementedException(); 89 | } 90 | 91 | public int get_DisplayName(out string pbstrDisplayName) 92 | { 93 | throw new NotImplementedException(); 94 | } 95 | 96 | public int get_IsDebugOnly(out int pfIsDebugOnly) 97 | { 98 | throw new NotImplementedException(); 99 | } 100 | 101 | public int get_IsPackaged(out int pfIsPackaged) 102 | { 103 | throw new NotImplementedException(); 104 | } 105 | 106 | public int get_IsReleaseOnly(out int pfIsReleaseOnly) 107 | { 108 | throw new NotImplementedException(); 109 | } 110 | 111 | public int get_IsSpecifyingOutputSupported(out int pfIsSpecifyingOutputSupported) 112 | { 113 | throw new NotImplementedException(); 114 | } 115 | 116 | public int get_Platform(out Guid pguidPlatform) 117 | { 118 | throw new NotImplementedException(); 119 | } 120 | 121 | public int get_ProjectCfgProvider(out IVsProjectCfgProvider ppIVsProjectCfgProvider) 122 | { 123 | throw new NotImplementedException(); 124 | } 125 | 126 | public int get_RootURL(out string pbstrRootURL) 127 | { 128 | throw new NotImplementedException(); 129 | } 130 | 131 | public int get_TargetCodePage(out uint puiTargetCodePage) 132 | { 133 | throw new NotImplementedException(); 134 | } 135 | 136 | public int get_UpdateSequenceNumber(ULARGE_INTEGER[] puliUSN) 137 | { 138 | throw new NotImplementedException(); 139 | } 140 | 141 | public int OpenOutput(string szOutputCanonicalName, out IVsOutput ppIVsOutput) 142 | { 143 | throw new NotImplementedException(); 144 | } 145 | 146 | } 147 | } -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/MonoSampleDebuggerSession.cs: -------------------------------------------------------------------------------- 1 | using Mono.Debugging.Soft; 2 | using System; 3 | using Mono.Debugging.Client; 4 | using EnvDTE; 5 | using System.IO; 6 | 7 | namespace Mono.Debugger.Sample 8 | { 9 | class MonoSampleDebuggerSession : SoftDebuggerSession 10 | { 11 | private System.Diagnostics.Process process; 12 | 13 | protected override void OnRun(DebuggerStartInfo startInfo) 14 | { 15 | base.OnRun(startInfo); 16 | UseOperationThread = true; 17 | 18 | var exeName = GetOutputAssembly(((Debugging.VisualStudio.StartInfo)startInfo).StartupProject); 19 | var monoDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Mono", "bin"); 20 | 21 | if (!Directory.Exists(monoDirectory)) 22 | throw new InvalidOperationException("Did not find Mono installation at expected location: " + monoDirectory); 23 | 24 | var args = ((Debugging.VisualStudio.StartInfo)startInfo).StartArgs as SoftDebuggerListenArgs; 25 | 26 | process = new System.Diagnostics.Process(); 27 | process.StartInfo = new System.Diagnostics.ProcessStartInfo(Path.Combine(monoDirectory, "mono.exe"), string.Format("--debug --debugger-agent=transport=dt_socket,address=127.0.0.1:{0} {1}", args.DebugPort, exeName)); 28 | process.StartInfo.WorkingDirectory = monoDirectory; 29 | process.StartInfo.UseShellExecute = true; 30 | process.Start(); 31 | } 32 | 33 | private string GetOutputAssembly(Project startupProject) 34 | { 35 | var baseFolder = startupProject.Properties.Item("FullPath").Value.ToString(); 36 | var outFolder = startupProject.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value.ToString(); 37 | var assemblyName = startupProject.Properties.Item("OutputFileName").Value.ToString(); 38 | 39 | return string.Format("\"{0}\"", Path.Combine(baseFolder, outFolder, assemblyName)); 40 | } 41 | 42 | protected override void OnExit() 43 | { 44 | process.Kill(); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/MonoSampleFlavoredProject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.Shell.Flavor; 3 | using Microsoft.VisualStudio.Shell.Interop; 4 | using Microsoft.VisualStudio; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace Mono.Debugger.Sample 8 | { 9 | internal class MonoSampleFlavoredProject : FlavoredProjectBase, IVsProjectFlavorCfgProvider 10 | { 11 | private IVsProjectFlavorCfgProvider innerFlavorConfig; 12 | private MonoSamplePackage package; 13 | 14 | public MonoSampleFlavoredProject(MonoSamplePackage package) 15 | { 16 | this.package = package; 17 | } 18 | 19 | public int CreateProjectFlavorCfg(IVsCfg pBaseProjectCfg, out IVsProjectFlavorCfg ppFlavorCfg) 20 | { 21 | IVsProjectFlavorCfg cfg = null; 22 | ppFlavorCfg = null; 23 | 24 | if (innerFlavorConfig != null) 25 | { 26 | object project; 27 | GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out project); 28 | 29 | this.innerFlavorConfig.CreateProjectFlavorCfg(pBaseProjectCfg, out cfg); 30 | ppFlavorCfg = new MonoSampleDebuggableConfig(cfg, project as EnvDTE.Project); 31 | } 32 | 33 | if (ppFlavorCfg != null) 34 | return VSConstants.S_OK; 35 | 36 | return VSConstants.E_FAIL; 37 | } 38 | 39 | protected override void SetInnerProject(IntPtr innerIUnknown) 40 | { 41 | object inner = null; 42 | 43 | inner = Marshal.GetObjectForIUnknown(innerIUnknown); 44 | innerFlavorConfig = inner as IVsProjectFlavorCfgProvider; 45 | 46 | if (base.serviceProvider == null) 47 | base.serviceProvider = this.package; 48 | 49 | base.SetInnerProject(innerIUnknown); 50 | } 51 | 52 | } 53 | } -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/MonoSamplePackage.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Company. All rights reserved. 4 | // 5 | //------------------------------------------------------------------------------ 6 | 7 | using System; 8 | using System.Diagnostics.CodeAnalysis; 9 | using System.Runtime.InteropServices; 10 | using Microsoft.VisualStudio.Shell; 11 | using Mono.Debugging.Client; 12 | 13 | namespace Mono.Debugger.Sample 14 | { 15 | [PackageRegistration(UseManagedResourcesOnly = true)] 16 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 17 | [Guid(PackageGuidString)] 18 | [ProvideProjectFactory(typeof (MonoSampleProjectFactory), "Mono.Debugger.Sample", null, null, null, null, LanguageVsTemplate = "CSharp", TemplateGroupIDsVsTemplate = "Mono.Debugger.Sample")] 19 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 20 | public sealed class MonoSamplePackage : Package 21 | { 22 | public const string PackageGuidString = "0610d5ad-36f3-4a90-a0ba-55736bf813ba"; 23 | public const string MonoSampleProjectGuid = "8F3E2DF0-C35C-4265-82FC-BEA011F4A7ED"; 24 | 25 | protected override void Initialize() 26 | { 27 | base.Initialize(); 28 | 29 | RegisterProjectFactory(new MonoSampleProjectFactory(this)); 30 | 31 | DebuggerLoggingService.CustomLogger = new NullLogger(); 32 | } 33 | } 34 | 35 | class NullLogger : ICustomLogger 36 | { 37 | public string GetNewDebuggerLogFilename() => null; 38 | 39 | public void LogAndShowException(string message, Exception ex) { } 40 | 41 | public void LogError(string message, Exception ex) { } 42 | 43 | public void LogMessage(string messageFormat, params object[] args) { } 44 | } 45 | } -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/MonoSampleProjectFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using System; 3 | using Microsoft.VisualStudio.Shell.Flavor; 4 | 5 | namespace Mono.Debugger.Sample 6 | { 7 | [ComVisible(false)] 8 | [Guid(MonoSamplePackage.MonoSampleProjectGuid)] 9 | public class MonoSampleProjectFactory : FlavoredProjectFactoryBase 10 | { 11 | private MonoSamplePackage package; 12 | 13 | public MonoSampleProjectFactory(MonoSamplePackage package) 14 | { 15 | this.package = package; 16 | } 17 | 18 | protected override object PreCreateForOuter(IntPtr outerProjectIUnknown) 19 | { 20 | return new MonoSampleFlavoredProject(package); 21 | } 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/MonoSampleStartInfo.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using Mono.Debugging.Soft; 3 | using Mono.Debugging.VisualStudio; 4 | 5 | namespace Mono.Debugger.Sample 6 | { 7 | internal class MonoSampleStartInfo : StartInfo 8 | { 9 | public MonoSampleStartInfo(SoftDebuggerStartArgs args, DebuggingOptions options, Project startupProject) : base(args, options, startupProject) 10 | { 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("Mono.Debugger.Sample")] 5 | [assembly: AssemblyProduct("Mono.Debugger.Sample")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("Xamarin")] 9 | [assembly: AssemblyCopyright("")] 10 | [assembly: AssemblyTrademark("")] 11 | [assembly: AssemblyCulture("")] 12 | 13 | [assembly: ComVisible(false)] 14 | [assembly: AssemblyVersion("1.0.0.0")] 15 | [assembly: AssemblyFileVersion("1.0.0.0")] 16 | -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/Resources/Mono.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/vs-mono-debugger-sample/e019cbe26eb9f476fbc0221d785a454d802089e6/src/Mono.Debugger.Sample/Resources/Mono.png -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/Resources/MonoSamplePackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/vs-mono-debugger-sample/e019cbe26eb9f476fbc0221d785a454d802089e6/src/Mono.Debugger.Sample/Resources/MonoSamplePackage.ico -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/VSPackage.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Mono Debugger Sample 122 | 123 | 124 | Showcases how to create a custom project flavor that leverages the Mono Debugger. 125 | 126 | 127 | 128 | Resources\MonoSamplePackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/Mono.Debugger.Sample/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mono Debugger Sample 6 | Showcases how to create a custom project flavor that leverages the Mono Debugger nuget package. 7 | Resources\Mono.png 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/MonoSampleProject/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("$projectname$")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("$registeredorganization$")] 12 | [assembly: AssemblyProduct("$projectname$")] 13 | [assembly: AssemblyCopyright("Copyright © $registeredorganization$ $year$")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("$guid1$")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/MonoSampleProject/MonoSampleProject.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 14.0 5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 6 | 7 | 8 | 14.0 9 | 10 | publish\ 11 | true 12 | Disk 13 | false 14 | Foreground 15 | 7 16 | Days 17 | false 18 | false 19 | true 20 | 0 21 | 1.0.0.%2a 22 | false 23 | false 24 | true 25 | 26 | 27 | 28 | Debug 29 | AnyCPU 30 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 31 | {74CCF091-8EAB-4706-8CD2-357BCAE45C2A} 32 | Library 33 | Properties 34 | MonoSampleProject 35 | MonoSampleProject 36 | v4.5 37 | 512 38 | false 39 | false 40 | false 41 | false 42 | false 43 | false 44 | false 45 | false 46 | false 47 | false 48 | 49 | 50 | true 51 | full 52 | false 53 | bin\Debug\ 54 | DEBUG;TRACE 55 | prompt 56 | 4 57 | 58 | 59 | pdbonly 60 | true 61 | bin\Release\ 62 | TRACE 63 | prompt 64 | 4 65 | 66 | 67 | 68 | False 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | False 90 | Microsoft .NET Framework 4.5 %28x86 and x64%29 91 | true 92 | 93 | 94 | False 95 | .NET Framework 3.5 SP1 96 | false 97 | 98 | 99 | 100 | 101 | 108 | -------------------------------------------------------------------------------- /src/MonoSampleProject/MonoSampleProject.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/vs-mono-debugger-sample/e019cbe26eb9f476fbc0221d785a454d802089e6/src/MonoSampleProject/MonoSampleProject.ico -------------------------------------------------------------------------------- /src/MonoSampleProject/MonoSampleProject.vstemplate: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | MonoSampleProject 5 | MonoSampleProject 6 | MonoSampleProject.ico 7 | CSharp 8 | 2.0 9 | 1000 10 | 7f0c1fee-c293-4bdf-b20a-0955ecdf9a21 11 | true 12 | MonoSampleProject 13 | true 14 | 15 | 16 | 17 | AssemblyInfo.cs 18 | Program.cs 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/MonoSampleProject/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace $safeprojectname$ 4 | { 5 | public static class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | Console.WriteLine("Mono Rocks!"); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MonoSampleProject/ProjectTemplate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | $guid1$ 9 | {8F3E2DF0-C35C-4265-82FC-BEA011F4A7ED};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | Exe 11 | Properties 12 | $safeprojectname$ 13 | $safeprojectname$ 14 | v$targetframeworkversion$ 15 | 512 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | $if$ ($targetframeworkversion$ >= 3.5) 37 | 38 | 39 | 40 | $endif$ 41 | $if$ ($targetframeworkversion$ >= 4.0) 42 | 43 | $endif$ 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/MonoSampleProject/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MonoSampleProject")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Daniel Cazzulino")] 12 | [assembly: AssemblyProduct("MonoSampleProject")] 13 | [assembly: AssemblyCopyright("Copyright © Daniel Cazzulino 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("74ccf091-8eab-4706-8cd2-357bcae45c2a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------------------------------------