From 434ed4e2ffb61e3f199c693e60f0510b7195105b Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Tue, 5 Apr 2016 18:16:55 -0700 Subject: [PATCH 01/13] Update debugger.md for rc2 This checkin updates debugger.md to what I believe we will want for RC2 ship. There are still a few steps in here which aren't correct quite _yet_. My next checkin will add the work arounds which are needed until we ship. --- debugger.md | 127 +++++++++++++++++++++++++++++----------------------- 1 file changed, 70 insertions(+), 57 deletions(-) diff --git a/debugger.md b/debugger.md index 3bd45d218b..5b1861a6fb 100644 --- a/debugger.md +++ b/debugger.md @@ -1,82 +1,95 @@ -#Instructions for setting up the .NET Core debugger - EXPERIMENTAL PREVIEW -Thank you for taking the time to try out our bits. -This page gives you detailed instructions on how to get your system running. +#Instructions for setting up the .NET Core debugger +This page gives you detailed instructions on how to debug code running under .NET Core in VS Code. ####Your Feedback​ -Please place your feedback [here](https://github.com/OmniSharp/omnisharp-vscode/issues). +File bugs and feature requests [here](https://github.com/OmniSharp/omnisharp-vscode/issues) and [join our insiders group](http://landinghub.visualstudio.com/dotnetcoreinsiders) to help us build great tooling for .NET Core. -####Prerequisites / Known Issues / Notes -* Requires .NET Core rc3-23829 or newer. These are daily builds of .NET Core that can be downloaded from the https://www.myget.org/F/dotnet-core/api/v3/index.json nuget feed. These are really daily builds of .NET Core and associated tools. So please continue if you want to dig in and have fun playing with new bits. But don't expect to go to production with those. +####Requirements +* Only works with the RC2 version of .NET Core * X64 only -* Supports Windows, OSX, and Ubuntu 14.04 -* In case you get this error on F5: *"No task runner configured - Tasks.json could not be found"*, see the 'once for each project' section below. -* If you don’t have mono installed you won't get IntelliSense. +* Supports OSX, Ubuntu 14.04, Red Hat Enterprise Linux 7.2, Debian 8.2, Centos 7.1, and Windows 7+ ###First Time setup -1. Get Visual Studio Code - * Install Visual Studio Code (VSC). Pick the latest VSC version from here: https://code.visualstudio.com Make sure it is at least 0.10.10. -2. Install Dotnet CLI - * Install Dotnet CLI following the instructions here: http://dotnet.github.io/getting-started - * **Hint for Mac**: Dotnet CLI requires openSSL to work. Don't forget this! Execute: `brew install openssl` - * **On Windows**: To be able to create portable PDBs you need a newer version of dotnet CLI. See [here](https://github.com/OmniSharp/omnisharp-vscode/wiki/Portable-PDBs#downloading-a-net-cli-which-supports-debugtype-option) for more information. -3. Install C# Extension for VS Code - * Open the command palette in VSC (F1) and type "ext install C#" to trigger the installation of the extension. - * VSC will show a message that the extension has been installed and it will restart. -4. Trigger download of platform specific binaries - * After the extension is installed, open any C# file in VSC. - * In the background a process is triggered to get required bits. You can follow that process in the output window of VSC. Wait to finish that process. -5. Install Mono (Linux/OSX) - * To be able to auto-create a tasks.json for every project you'll currently need Mono. You could skip this step, but then you need to create the file manually. - * Follow the instructions [how to install mono here](http://www.mono-project.com/docs/getting-started/install/). Make sure the version you have installed is >=4.0.1. +##### 1: Get Visual Studio Code +Install Visual Studio Code (VSC). Pick the latest VSC version from here: https://code.visualstudio.com Make sure it is at least 0.10.10. + +##### 2: Install .NET command line tools +Install the .NET Core command line tools (CLI) by following the installation part of the instructions here: http://dotnet.github.io/getting-started + +**Hint for Mac**: .NET Core requires openSSL to work. Don't forget this! Execute: `brew install openssl` + +##### 3: Install C# Extension for VS Code +Open the command palette in VS Code (F1) and type "ext install C#" to trigger the installation of the extension. VS Code will show a message that the extension has been installed and it will restart. + +If you have previously installed the C# extension, make sure that you have version 1.0.0-rc2 or newer. You can check this by opening the command palette (F1) and running 'Extensions: Show Installed Extensions'. + +##### 4: Wait for download of platform-specific files +The first time that C# code is opened in VS Code, the extension will download the platform-specific files needed for debugging and editing. Debugging and editor features will not work until these steps finish. ###Once for each project The following steps have to executed for every project. -* First, modify your project.json to reference "NETStandard.Library":"1.0.0-rc3-*" - * Currently *dotnet new* creates a project.json that references a version that's too old. You should also get a hint to modify this. - * Afterwards run *dotnet restore*. You can run this in VSC from the command palette (F1). -* Whenever you want to start debugging a .NET Core app (e.g. by pressing the debugger-play button) select '.NET Core" for debug environment in the command palette when VS code first asks for it. -* If you want 'compile' support for F5 you need to create a tasks.json file. There are multiple ways to do this. - * You can open the command palette in VSC (F1) and run the command *"Debugger: Add tasks.json"* (Make sure you have installed Mono - * Or you can get it [here](https://github.com/OmniSharp/omnisharp-vscode/blob/dev/template-tasks.json) and put it manually next to your launch.json file -to be able to do so, see above. If you don't have Mono installed you might get an error saying *Omnisharp not running*.) - * Or if you just want debugging, you can comment out 'preCompileTask' field​ in launch.json. -* Before you can launch, you must change your launch.json to enter the name of the executable in 'program' field (including the path). - * **If you are using the recomended builds of the .NET CLI**: This could be something like *"${workspaceRoot}/bin/Debug/dnxcore50/osx.10.11-x64/HelloWorld"*. On Ubuntu, replace the 'osx...' folder with 'ubuntu.14.04-x64', on Windows, use 'win7-x64'. If are aren't sure, drop to the command line, do a 'dotnet build' and look for the built executable file (**NOT** .dll) under the 'bin/Debug' directory. On Windows, you can still use forward slashes. - * **If you are using brand new builds of the .NET CLI (ignore this unless you went out of your way to install the newest bits)**: The CLI will no longer drop a native host executable by default. Future versions of this extension will improve this process, but for now you want to -- - * Set 'program' to the path to the 'dotnet' executable. You can find the path to dotnet using `which dotnet` (OSX/Linux) or `where.exe dotnet.exe` (Windows). - * Set the first element in 'args' to the path to the dll. Example: - `"args": [ "bin/Debug/netstandard1.5/MyApplication.dll" ],` -* **Windows Only**: [Change the project.json to use portable PDBs](https://github.com/OmniSharp/omnisharp-vscode/wiki/Portable-PDBs#net-cli-projects-projectjson). -* In case you get a restore error due to lack of a NuGet.Config file, just create this file in the root directory of your project. You can find a sample [here](https://github.com/Microsoft/MIEngine/blob/abeebec39221c654bd69a0d2bcadca6a4a0d0392/tools/InstallToVSCode/CLRDependencies/NuGet.Config). + +##### 1: Get a project +You can start from scratch by creating an empty project with `dotnet new`: + + cd ~ + mkdir MyApplication + cd MyApplication + dotnet new + dotnet restore + +You can also find some example projects on https://github.com/aspnet/cli-samples + +##### 2: Open the directory in VS Code +Go to File->Open and open the directory in Visual Studio Code. If this is the first time that the C# extension has been activated, it will now download additional platform-specific dependencies. + +##### 3: Add VS Code configuration files to the workspace +VS Code needs to be configured so it understands how to build your project and debug it. For this there are two files which need to be added -- .vscode/tasks.json and .vscode/launch.json. Tasks.json is used to configure what command line command is executed to build your project, and launch.json configures the type of debugger you want to use, and what program should be run under that debugger. Launch.json also configures VS Code to run the build task from tasks.json so that your program is automatically up-to-date each time you go to debug it. + +For most projects, the C# extension can automatically generate these files for you. When you open a project and the C# extension is installed, you should see the following prompt in VS Code: + +![Info: Required assets to build and debug are missing from your project. Add them? Yes | Close](https://raw.githubusercontent.com/wiki/OmniSharp/omnisharp-vscode/images/info-bar-add-required-assets.png) + +Clicking 'Yes' on this prompt should add these resources. + +In case you would rather generate .vscode/tasks.json by hand, you can start with [this example](https://raw.githubusercontent.com/wiki/OmniSharp/omnisharp-vscode/ExampleCode/tasks.json) which configures VS Code to launch 'dotnet build'. If you don't want to build from VS Code at all, you can skip this file. If you do this, you will need to comment out the 'preLaunchTask' from .vscode/launch.json when you create it. + +In case you would rather generate .vscode/launch.json by hand, when you want to start debugging, press the debugger play button (or hit F5) as you would normally do. VS Code will provide a list of templates to select from. Pick ".NET Core" from this list and the edit the 'program' property to indicate the path to the application dll or .NET Core host executable to launch. + +##### 4: Windows Only: Enable Portable PDBs +In the future, this step will go away, but for now you need to [change the project.json to use portable PDBs](https://github.com/OmniSharp/omnisharp-vscode/wiki/Portable-PDBs#net-cli-projects-projectjson). + +##### 5: Pick your debug configuration + +The default launch.json offers several different launch configurations depending on what kind of app you are building -- one for command line, one for web, and one for attaching to a running process. + +To configure which configuration you want, bring up the Debug view by clicking on the Debugging icon in the View Bar on the side of VS Code. + +![Debug view icon](https://raw.githubusercontent.com/wiki/OmniSharp/omnisharp-vscode/images/debugging_debugicon.png) + +Now open the configuration drop down from the top and select the one you want. + +![Debug launch configuration drop down](https://raw.githubusercontent.com/wiki/OmniSharp/omnisharp-vscode/images/debug-launch-configurations.png) ###Debugging Code compiled on another computer -* If the target binary is built on Linux / OSX, dotnet CLI will produce portable pdbs by default so no action is necessary. +* If the target binary is built on Linux / OSX, dotnet CLI will produce portable pdbs by default so no action is necessary. * On Windows, you will need to take additional steps to build [portable PDBs](https://github.com/OmniSharp/omnisharp-vscode/wiki/Portable-PDBs#how-to-generate-portable-pdbs). ####More things to configure In launch.json #####Just My Code You can optionally disable justMyCode by setting it to "false". ->*"justMyCode":false* + + "justMyCode":false* #####Source File Map You can optionally configure a file by file mapping by providing map following this schema: ->"sourceFileMap": { - "C:\foo":"/home/me/foo" - } + "sourceFileMap": { + "C:\foo":"/home/me/foo" + } #####Symbol Path You can optionally provide paths to symbols following this schema: ->"symbolPath":"[ \"/Volumes/symbols\"]" - - -###Debugging ASP.NET Core -In case you want to debug ASP.NET Core applications you can find [samples to get started](https://github.com/caslan/cli-samples) here. To get started: - - git clone https://github.com/caslan/cli-samples.git --branch fordebuggerpreview - cd cli-samples/HelloMvc - dotnet restore -To be able to run the samples on Linux using Kestrel as Webserver, follow the [setup instructions "Install libuv" here](http://docs.asp.net/en/latest/getting-started/installing-on-linux.html#install-libuv). -Currently this page also contains other steps which were required earlier only. Those other sections can be ignored. + "symbolPath":"[ \"/Volumes/symbols\"]" From d4e111796d1c7c56019ca4a3f0909700cc9ae787 Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Mon, 11 Apr 2016 17:23:18 -0700 Subject: [PATCH 02/13] Respond to feedback for debugger.md This makes some improvements to debugger.md based on feedback from Noah and Andrew. --- debugger.md | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/debugger.md b/debugger.md index 5b1861a6fb..e2840c50c5 100644 --- a/debugger.md +++ b/debugger.md @@ -5,18 +5,23 @@ This page gives you detailed instructions on how to debug code running under .NE File bugs and feature requests [here](https://github.com/OmniSharp/omnisharp-vscode/issues) and [join our insiders group](http://landinghub.visualstudio.com/dotnetcoreinsiders) to help us build great tooling for .NET Core. ####Requirements -* Only works with the RC2 version of .NET Core +* Requires .NET Core RC2 (will not work with earlier versions) * X64 only * Supports OSX, Ubuntu 14.04, Red Hat Enterprise Linux 7.2, Debian 8.2, Centos 7.1, and Windows 7+ ###First Time setup ##### 1: Get Visual Studio Code -Install Visual Studio Code (VSC). Pick the latest VSC version from here: https://code.visualstudio.com Make sure it is at least 0.10.10. +Install Visual Studio Code (VSC). Pick the latest VSC version from here: https://code.visualstudio.com Make sure it is at least 0.10.10. + +If you are not sure what version you have, you can see your version of VS Code: + +* **OSX:** Code->Abort Visual Studio Code +* **Windows / Linux:** Help->Abort ##### 2: Install .NET command line tools Install the .NET Core command line tools (CLI) by following the installation part of the instructions here: http://dotnet.github.io/getting-started -**Hint for Mac**: .NET Core requires openSSL to work. Don't forget this! Execute: `brew install openssl` +**OSX:** .NET Core requires openSSL to work. Don't forget this! Execute: `brew install openssl` ##### 3: Install C# Extension for VS Code Open the command palette in VS Code (F1) and type "ext install C#" to trigger the installation of the extension. VS Code will show a message that the extension has been installed and it will restart. @@ -45,7 +50,10 @@ You can also find some example projects on https://github.com/aspnet/cli-samples Go to File->Open and open the directory in Visual Studio Code. If this is the first time that the C# extension has been activated, it will now download additional platform-specific dependencies. ##### 3: Add VS Code configuration files to the workspace -VS Code needs to be configured so it understands how to build your project and debug it. For this there are two files which need to be added -- .vscode/tasks.json and .vscode/launch.json. Tasks.json is used to configure what command line command is executed to build your project, and launch.json configures the type of debugger you want to use, and what program should be run under that debugger. Launch.json also configures VS Code to run the build task from tasks.json so that your program is automatically up-to-date each time you go to debug it. +VS Code needs to be configured so it understands how to build your project and debug it. For this there are two files which need to be added -- .vscode/tasks.json and .vscode/launch.json. + +* Tasks.json is used to configure what command line command is executed to build your project, and launch.json configures the type of debugger you want to use, and what program should be run under that debugger. +* Launch.json configures VS Code to run the build task from tasks.json so that your program is automatically up-to-date each time you go to debug it. For most projects, the C# extension can automatically generate these files for you. When you open a project and the C# extension is installed, you should see the following prompt in VS Code: @@ -53,6 +61,8 @@ For most projects, the C# extension can automatically generate these files for y Clicking 'Yes' on this prompt should add these resources. +**Creating configuration files manually** + In case you would rather generate .vscode/tasks.json by hand, you can start with [this example](https://raw.githubusercontent.com/wiki/OmniSharp/omnisharp-vscode/ExampleCode/tasks.json) which configures VS Code to launch 'dotnet build'. If you don't want to build from VS Code at all, you can skip this file. If you do this, you will need to comment out the 'preLaunchTask' from .vscode/launch.json when you create it. In case you would rather generate .vscode/launch.json by hand, when you want to start debugging, press the debugger play button (or hit F5) as you would normally do. VS Code will provide a list of templates to select from. Pick ".NET Core" from this list and the edit the 'program' property to indicate the path to the application dll or .NET Core host executable to launch. @@ -78,10 +88,15 @@ Now open the configuration drop down from the top and select the one you want. ####More things to configure In launch.json #####Just My Code -You can optionally disable justMyCode by setting it to "false". +You can optionally disable justMyCode by setting it to "false". You should disable Just My Code when you are trying to debug into a library that you pulled down which doesn't have symbols or is optimized. "justMyCode":false* +Just My Code is a set of features that makes it easier to focus on debugging your code by hiding some of the details of optimized libraries that you might be using, like the .NET Framework itself. The most important sub parts of this feature are -- + +* User-unhandled exceptions: automatically stop the debugger just before exceptions are about to be caught by the framework +* Just My Code stepping: when stepping, if framework code calls back to user code, automaticially stop. + #####Source File Map You can optionally configure a file by file mapping by providing map following this schema: From 1f4f4b0f2db5688d6d673700cf823b9cbc3f8f6b Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Tue, 12 Apr 2016 13:28:17 -0700 Subject: [PATCH 03/13] Add debugger download troubleshooting to debugger.md #161 This add suggestions for troubleshooting download errors for the debugger to debugger.md. --- debugger.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debugger.md b/debugger.md index e2840c50c5..4e43f9d569 100644 --- a/debugger.md +++ b/debugger.md @@ -49,6 +49,13 @@ You can also find some example projects on https://github.com/aspnet/cli-samples ##### 2: Open the directory in VS Code Go to File->Open and open the directory in Visual Studio Code. If this is the first time that the C# extension has been activated, it will now download additional platform-specific dependencies. +**Troubleshooting 'Error while installing .NET Core Debugger':** If the debugger is failing to download its platform-specific dependencies, first verify that you have the RC2 build of the .NET CLI installed, and it is functioning. You can check this by starting a bash/command prompt and running 'dotnet --info'. + +If the CLI is installed, here are a few additional suggestions: + +* If clicking on 'View Log' doesn't show a log this means that running the 'dotnet --info' command failed. If it succeeds in bash/command prompt, but fails from VS Code, this likely means that your computer once had an older build of .NET CLI installed, and there are still remnants of it which cause VS Code and other processes besides bash to use the older version instead of the current version. You can try to clean your computer using the uninstall suggestions from http://dotnet.github.io/getting-started/. +* If 'dotnet restore' is failing, make sure you have an internet connection to nuget.org, and make sure that if additional NuGet.Config files are being used, they have valid content. The log will indicate what NuGet.Config files were used. Try removing the files other than the one coming from the extension itself. + ##### 3: Add VS Code configuration files to the workspace VS Code needs to be configured so it understands how to build your project and debug it. For this there are two files which need to be added -- .vscode/tasks.json and .vscode/launch.json. From da47cb06c0c781a6a9d0c5abd08ebb5b893e3cbe Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Mon, 25 Apr 2016 10:22:34 -0700 Subject: [PATCH 04/13] Update CoreCLR to 24022 --- package.json | 2 +- src/coreclr-debug/main.ts | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index b15390c9e7..dd2ae0f890 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "csharp", "publisher": "ms-vscode", - "version": "1.0.3-rc2", + "version": "1.0.4-rc2", "description": "C# for Visual Studio Code (powered by OmniSharp).", "displayName": "C#", "author": "Microsoft Corporation", diff --git a/src/coreclr-debug/main.ts b/src/coreclr-debug/main.ts index c8502cd8d2..e0aefb65a0 100644 --- a/src/coreclr-debug/main.ts +++ b/src/coreclr-debug/main.ts @@ -263,28 +263,28 @@ function createProjectJson(targetRuntime: string): any emitEntryPoint: true }, dependencies: { - "Microsoft.VisualStudio.clrdbg": "14.0.25214-preview-2934931", + "Microsoft.VisualStudio.clrdbg": "14.0.25225-preview-2954453", "Microsoft.VisualStudio.clrdbg.MIEngine": "14.0.30401-preview-1", "Microsoft.VisualStudio.OpenDebugAD7": "1.0.20405-preview-1", - "NETStandard.Library": "1.5.0-rc2-24008", + "NETStandard.Library": "1.5.0-rc2-24022", "Newtonsoft.Json": "7.0.1", "Microsoft.VisualStudio.Debugger.Interop.Portable": "1.0.1", - "System.Collections.Specialized": "4.0.1-rc2-24008", - "System.Collections.Immutable": "1.2.0-rc2-24008", - "System.Diagnostics.Process" : "4.1.0-rc2-24008", - "System.Diagnostics.StackTrace": "4.0.1-rc2-24008", - "System.Dynamic.Runtime": "4.0.11-rc2-24008", - "Microsoft.CSharp": "4.0.1-rc2-24008", - "System.Threading.Tasks.Dataflow": "4.6.0-rc2-24008", - "System.Threading.Thread": "4.0.0-rc2-24008", - "System.Xml.XDocument": "4.0.11-rc2-24008", - "System.Xml.XmlDocument": "4.0.1-rc2-24008", - "System.Xml.XmlSerializer": "4.0.11-rc2-24008", - "System.ComponentModel": "4.0.1-rc2-24008", - "System.ComponentModel.Annotations": "4.1.0-rc2-24008", - "System.ComponentModel.EventBasedAsync": "4.0.11-rc2-24008", - "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", - "System.Net.Http": "4.0.1-rc2-24008" + "System.Collections.Specialized": "4.0.1-rc2-24022", + "System.Collections.Immutable": "1.2.0-rc2-24022", + "System.Diagnostics.Process" : "4.1.0-rc2-24022", + "System.Diagnostics.StackTrace": "4.0.1-rc2-24022", + "System.Dynamic.Runtime": "4.0.11-rc2-24022", + "Microsoft.CSharp": "4.0.1-rc2-24022", + "System.Threading.Tasks.Dataflow": "4.6.0-rc2-24022", + "System.Threading.Thread": "4.0.0-rc2-24022", + "System.Xml.XDocument": "4.0.11-rc2-24022", + "System.Xml.XmlDocument": "4.0.1-rc2-24022", + "System.Xml.XmlSerializer": "4.0.11-rc2-24022", + "System.ComponentModel": "4.0.1-rc2-24022", + "System.ComponentModel.Annotations": "4.1.0-rc2-24022", + "System.ComponentModel.EventBasedAsync": "4.0.11-rc2-24022", + "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24022", + "System.Net.Http": "4.0.1-rc2-24022" }, frameworks: { "netstandardapp1.5": { From c5687f0a15897d3f8623020e27e603a1d5c3402f Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Mon, 25 Apr 2016 13:00:43 -0700 Subject: [PATCH 05/13] Improve multi-project instructions This improves the instructions to better indicate how to configure launch.json/tasks.json for workspaces with multiple projects. --- debugger.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/debugger.md b/debugger.md index 4e43f9d569..64a990d625 100644 --- a/debugger.md +++ b/debugger.md @@ -62,7 +62,7 @@ VS Code needs to be configured so it understands how to build your project and d * Tasks.json is used to configure what command line command is executed to build your project, and launch.json configures the type of debugger you want to use, and what program should be run under that debugger. * Launch.json configures VS Code to run the build task from tasks.json so that your program is automatically up-to-date each time you go to debug it. -For most projects, the C# extension can automatically generate these files for you. When you open a project and the C# extension is installed, you should see the following prompt in VS Code: +If you open the folder containing your project.json, the C# extension can automatically generate these files for you. When you open a project and the C# extension is installed, you should see the following prompt in VS Code: ![Info: Required assets to build and debug are missing from your project. Add them? Yes | Close](https://raw.githubusercontent.com/wiki/OmniSharp/omnisharp-vscode/images/info-bar-add-required-assets.png) @@ -70,9 +70,16 @@ Clicking 'Yes' on this prompt should add these resources. **Creating configuration files manually** -In case you would rather generate .vscode/tasks.json by hand, you can start with [this example](https://raw.githubusercontent.com/wiki/OmniSharp/omnisharp-vscode/ExampleCode/tasks.json) which configures VS Code to launch 'dotnet build'. If you don't want to build from VS Code at all, you can skip this file. If you do this, you will need to comment out the 'preLaunchTask' from .vscode/launch.json when you create it. +If your code has multiple projects or you would rather generate these files by hand, here is how -- -In case you would rather generate .vscode/launch.json by hand, when you want to start debugging, press the debugger play button (or hit F5) as you would normally do. VS Code will provide a list of templates to select from. Pick ".NET Core" from this list and the edit the 'program' property to indicate the path to the application dll or .NET Core host executable to launch. +**.vscode/tasks.json**: Start with [this example](https://raw.githubusercontent.com/wiki/OmniSharp/omnisharp-vscode/ExampleCode/tasks.json) which configures VS Code to launch 'dotnet build'. Update the 'cwd' property if your project isn't in the root of the open folder. If you don't want to build from VS Code at all, you can skip this file. If you do this, you will need to comment out the 'preLaunchTask' from .vscode/launch.json when you create it. + +**.vscode/launch.json**: When you want to start debugging, press the debugger play button (or hit F5) as you would normally do. VS Code will provide a list of templates to select from. Pick ".NET Core" from this list and the edit the 'program' property to indicate the path to the application dll or .NET Core host executable to launch. For example: + + "configurations": [ + { + ... + "program": "${workspaceRoot}/MyLaunchingProject/bin/Debug/netcoreapp1.0/MyLaunchingProject.dll", ##### 4: Windows Only: Enable Portable PDBs In the future, this step will go away, but for now you need to [change the project.json to use portable PDBs](https://github.com/OmniSharp/omnisharp-vscode/wiki/Portable-PDBs#net-cli-projects-projectjson). From 33a1a1e96ba7025bde47c2db6a193df00b7b69d5 Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Thu, 28 Apr 2016 16:54:25 -0700 Subject: [PATCH 06/13] Update debugger packages This updates the version of .NET Core used by the debugger to rc2-24027. This updates the version of clrdbg used by the debugger to 14.0.25229, which resolves: https://github.com/OmniSharp/omnisharp-vscode/issues/251 --- package.json | 2 +- src/coreclr-debug/main.ts | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index dd2ae0f890..cefdd91e34 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "csharp", "publisher": "ms-vscode", - "version": "1.0.4-rc2", + "version": "1.0.5-rc2", "description": "C# for Visual Studio Code (powered by OmniSharp).", "displayName": "C#", "author": "Microsoft Corporation", diff --git a/src/coreclr-debug/main.ts b/src/coreclr-debug/main.ts index e0aefb65a0..8b2dce38c3 100644 --- a/src/coreclr-debug/main.ts +++ b/src/coreclr-debug/main.ts @@ -263,28 +263,28 @@ function createProjectJson(targetRuntime: string): any emitEntryPoint: true }, dependencies: { - "Microsoft.VisualStudio.clrdbg": "14.0.25225-preview-2954453", + "Microsoft.VisualStudio.clrdbg": "14.0.25229-preview-2963841", "Microsoft.VisualStudio.clrdbg.MIEngine": "14.0.30401-preview-1", "Microsoft.VisualStudio.OpenDebugAD7": "1.0.20405-preview-1", - "NETStandard.Library": "1.5.0-rc2-24022", + "NETStandard.Library": "1.5.0-rc2-24027", "Newtonsoft.Json": "7.0.1", "Microsoft.VisualStudio.Debugger.Interop.Portable": "1.0.1", - "System.Collections.Specialized": "4.0.1-rc2-24022", - "System.Collections.Immutable": "1.2.0-rc2-24022", - "System.Diagnostics.Process" : "4.1.0-rc2-24022", - "System.Diagnostics.StackTrace": "4.0.1-rc2-24022", - "System.Dynamic.Runtime": "4.0.11-rc2-24022", - "Microsoft.CSharp": "4.0.1-rc2-24022", - "System.Threading.Tasks.Dataflow": "4.6.0-rc2-24022", - "System.Threading.Thread": "4.0.0-rc2-24022", - "System.Xml.XDocument": "4.0.11-rc2-24022", - "System.Xml.XmlDocument": "4.0.1-rc2-24022", - "System.Xml.XmlSerializer": "4.0.11-rc2-24022", - "System.ComponentModel": "4.0.1-rc2-24022", - "System.ComponentModel.Annotations": "4.1.0-rc2-24022", - "System.ComponentModel.EventBasedAsync": "4.0.11-rc2-24022", - "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24022", - "System.Net.Http": "4.0.1-rc2-24022" + "System.Collections.Specialized": "4.0.1-rc2-24027", + "System.Collections.Immutable": "1.2.0-rc2-24027", + "System.Diagnostics.Process" : "4.1.0-rc2-24027", + "System.Diagnostics.StackTrace": "4.0.1-rc2-24027", + "System.Dynamic.Runtime": "4.0.11-rc2-24027", + "Microsoft.CSharp": "4.0.1-rc2-24027", + "System.Threading.Tasks.Dataflow": "4.6.0-rc2-24027", + "System.Threading.Thread": "4.0.0-rc2-24027", + "System.Xml.XDocument": "4.0.11-rc2-24027", + "System.Xml.XmlDocument": "4.0.1-rc2-24027", + "System.Xml.XmlSerializer": "4.0.11-rc2-24027", + "System.ComponentModel": "4.0.1-rc2-24027", + "System.ComponentModel.Annotations": "4.1.0-rc2-24027", + "System.ComponentModel.EventBasedAsync": "4.0.11-rc2-24027", + "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24027", + "System.Net.Http": "4.0.1-rc2-24027" }, frameworks: { "netstandardapp1.5": { From ccd0df79be6a9041019272a57764fd842f6f5fea Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 13 May 2016 16:38:23 -0700 Subject: [PATCH 07/13] Update to latest OmniSharp build --- package.json | 2 +- src/omnisharpDownload.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index cefdd91e34..4e32ca796e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "csharp", "publisher": "ms-vscode", - "version": "1.0.5-rc2", + "version": "1.0.6-rc2", "description": "C# for Visual Studio Code (powered by OmniSharp).", "displayName": "C#", "author": "Microsoft Corporation", diff --git a/src/omnisharpDownload.ts b/src/omnisharpDownload.ts index 4c96051c9c..52886da8ae 100644 --- a/src/omnisharpDownload.ts +++ b/src/omnisharpDownload.ts @@ -14,7 +14,7 @@ const Decompress = require('decompress'); const Github = require('github-releases'); const OmnisharpRepo = 'OmniSharp/omnisharp-roslyn'; -const OmnisharpVersion = 'v1.9-alpha13'; +const OmnisharpVersion = 'v1.9-alpha14'; const DefaultInstallLocation = path.join(__dirname, '../.omnisharp'); tmp.setGracefulCleanup(); From 4755eeed2566c9b3dab35da30b1e3a6eed3b2ee6 Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Fri, 13 May 2016 11:17:53 -0700 Subject: [PATCH 08/13] Remove myget.org package sources --- coreclr-debug/NuGet.config | 2 -- 1 file changed, 2 deletions(-) diff --git a/coreclr-debug/NuGet.config b/coreclr-debug/NuGet.config index 9567dad4b9..5db080cb7d 100644 --- a/coreclr-debug/NuGet.config +++ b/coreclr-debug/NuGet.config @@ -3,8 +3,6 @@ - - From b5426bea708c2f6eeb11af20e10299f8e3a09f8e Mon Sep 17 00:00:00 2001 From: Cagri Aslan Date: Mon, 16 May 2016 08:02:40 -0700 Subject: [PATCH 09/13] Update extension version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4e32ca796e..b307cb8d9d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "csharp", "publisher": "ms-vscode", - "version": "1.0.6-rc2", + "version": "1.0.7-rc2", "description": "C# for Visual Studio Code (powered by OmniSharp).", "displayName": "C#", "author": "Microsoft Corporation", From 1a027db5512b06605edccb01296b5f435bc9c9ec Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Mon, 16 May 2016 10:44:56 -0700 Subject: [PATCH 10/13] Add API token for accessing GitHub releases --- src/omnisharpDownload.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/omnisharpDownload.ts b/src/omnisharpDownload.ts index 52886da8ae..5a0a6608e2 100644 --- a/src/omnisharpDownload.ts +++ b/src/omnisharpDownload.ts @@ -16,6 +16,7 @@ const Github = require('github-releases'); const OmnisharpRepo = 'OmniSharp/omnisharp-roslyn'; const OmnisharpVersion = 'v1.9-alpha14'; const DefaultInstallLocation = path.join(__dirname, '../.omnisharp'); +const ApiToken = '18a6f5ecea711220d4f433d4fd41062d479fda1d'; tmp.setGracefulCleanup(); @@ -48,7 +49,7 @@ export function downloadOmnisharp(): Promise { return new Promise((resolve, reject) => { console.log(`[OmniSharp]: Installing to ${DefaultInstallLocation}`); - const repo = new Github({ repo: OmnisharpRepo, token: null }); + const repo = new Github({ repo: OmnisharpRepo, token: ApiToken }); const assetName = getOmnisharpAssetName(); console.log(`[OmniSharp] Looking for ${OmnisharpVersion}, ${assetName}...`); From 5599656da6462502e4b8407298bfa8f2b9b6b460 Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Mon, 16 May 2016 10:16:03 -0700 Subject: [PATCH 11/13] Update README.md to reference the OmniSharp extension --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d02941c0a3..851af36f20 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,25 @@ |:--:|:--:| |[![Master Build Status](https://travis-ci.org/OmniSharp/omnisharp-vscode.svg?branch=master)](https://travis-ci.org/OmniSharp/omnisharp-vscode)|[![Dev Build Status](https://travis-ci.org/OmniSharp/omnisharp-vscode.svg?branch=dev)](https://travis-ci.org/OmniSharp/omnisharp-vscode)| -Don't install this extension unless you want to try an early version. - -This is a preview of C# support in Visual Studio code. It is designed to work well with the upcoming [.NET Core 1.0](http://dotnet.github.io/). +This is a preview of C# support in Visual Studio code. It is designed to work well with [.NET Core 1.0](http://dotnet.github.io/). These new projects are based on project.json and the [.NET CLI](https://dotnet.github.io/getting-started/). +### Support for .csproj + +Support for .csproj projects will be improved in future versions of this extension. For now, if you are targeting Mono scenarios (ex: Unity +or Xamarin) we suggest instead installing the 'Built-in Omnisharp' extension. Note that the name of the Omnisharp extension is no longer +correct - the extension is no longer built into VS Code. + +Installation steps for the Omnisharp extension -- + +1. Install ASP.NET 5 RC1 (NOTE: Do **NOT** use RC2) + * Windows: https://docs.asp.net/en/1.0.0-rc1/getting-started/installing-on-windows.html + * OSX: https://docs.asp.net/en/1.0.0-rc1/getting-started/installing-on-mac.html. Follow the instructions for using Mono. + * Linux: https://docs.asp.net/en/1.0.0-rc1/getting-started/installing-on-linux.html. Follow the instructions for using Mono. +2. Bring up the extension list in VS Code by opening the command pallet (F1 key) and type 'ext install'. +3. After VS Code has downloaded the extension list, type 'omnisharp' and select 'Built-in Omnisharp' from the list. +4. Open a C# file. If intellisense isn't working, open the output window (View->Toggle Output) and look at the 'OmniSharp Log'. + ### Debugging This version supports basic debugging capabilities. See http://aka.ms/vscclrdebugger for details. From 1d9b103be1000cb0bc136b33afbea837cbe749f1 Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Mon, 16 May 2016 12:39:36 -0700 Subject: [PATCH 12/13] Update version number to 1.0.8 VS Code marketplace didn't support versioning suffixes. Removing. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b307cb8d9d..60ad54a05f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "csharp", "publisher": "ms-vscode", - "version": "1.0.7-rc2", + "version": "1.0.8", "description": "C# for Visual Studio Code (powered by OmniSharp).", "displayName": "C#", "author": "Microsoft Corporation", From 4b48c6290f6bd02bddd9537ba81917499184eef7 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Mon, 16 May 2016 15:21:03 -0700 Subject: [PATCH 13/13] No longer download OmniSharp from GitHub releases --- package.json | 3 +- src/omnisharpDownload.ts | 71 ++++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index 60ad54a05f..35c02016d0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "csharp", "publisher": "ms-vscode", - "version": "1.0.8", + "version": "1.0.9", "description": "C# for Visual Studio Code (powered by OmniSharp).", "displayName": "C#", "author": "Microsoft Corporation", @@ -21,7 +21,6 @@ "decompress": "^3.0.0", "del": "^2.0.2", "fs-extra-promise": "^0.3.1", - "github-releases": "^0.3.0", "run-in-terminal": "*", "semver": "*", "vscode-debugprotocol": "^1.6.1", diff --git a/src/omnisharpDownload.ts b/src/omnisharpDownload.ts index 5a0a6608e2..0e8a889207 100644 --- a/src/omnisharpDownload.ts +++ b/src/omnisharpDownload.ts @@ -7,14 +7,15 @@ import * as fs from 'fs-extra-promise'; import * as path from 'path'; +import * as https from 'https'; +import * as stream from 'stream'; import * as tmp from 'tmp'; +import {parse} from 'url'; import {SupportedPlatform, getSupportedPlatform} from './utils'; const Decompress = require('decompress'); -const Github = require('github-releases'); -const OmnisharpRepo = 'OmniSharp/omnisharp-roslyn'; -const OmnisharpVersion = 'v1.9-alpha14'; +const BaseDownloadUrl = 'https://vscodeoscon.blob.core.windows.net/ext'; const DefaultInstallLocation = path.join(__dirname, '../.omnisharp'); const ApiToken = '18a6f5ecea711220d4f433d4fd41062d479fda1d'; @@ -45,46 +46,39 @@ function getOmnisharpAssetName(): string { } } +function download(urlString: string): Promise { + let url = parse(urlString); + let options: https.RequestOptions = { + host: url.host, + path: url.path, + } + + return new Promise((resolve, reject) => { + return https.get(options, res => { + // handle redirection + if (res.statusCode === 302) { + return download(res.headers.location); + } + else if (res.statusCode !== 200) { + return reject(Error(`Download failed with code ${res.statusCode}.`)); + } + + return resolve(res); + }); + }); +} + export function downloadOmnisharp(): Promise { return new Promise((resolve, reject) => { console.log(`[OmniSharp]: Installing to ${DefaultInstallLocation}`); - const repo = new Github({ repo: OmnisharpRepo, token: ApiToken }); const assetName = getOmnisharpAssetName(); + const urlString = `${BaseDownloadUrl}/${assetName}`; - console.log(`[OmniSharp] Looking for ${OmnisharpVersion}, ${assetName}...`); - - repo.getReleases({ tag_name: OmnisharpVersion }, (err, releases) => { - if (err) { - return reject(err); - } - - if (!releases.length) { - return reject(new Error(`OmniSharp release ${OmnisharpVersion} not found.`)); - } - - // Note: there should only be a single release, but use the first one - // if there are ever multiple results. Same thing for assets. - let foundAsset = null; - - for (var asset of releases[0].assets) { - if (asset.name === assetName) { - foundAsset = asset; - break; - } - } - - if (!foundAsset) { - return reject(new Error(`OmniSharp release ${OmnisharpVersion} asset, ${assetName} not found.`)); - } - - console.log(`[OmniSharp] Found it!`); - - repo.downloadAsset(foundAsset, (err, inStream) => { - if (err) { - return reject(err); - } - + console.log(`[OmniSharp] Attempting to download ${assetName}...`); + + return download(urlString) + .then(inStream => { tmp.file((err, tmpPath, fd, cleanupCallback) => { if (err) { return reject(err); @@ -106,7 +100,7 @@ export function downloadOmnisharp(): Promise { .src(tmpPath) .dest(DefaultInstallLocation); - if (path.extname(foundAsset.name).toLowerCase() === '.zip') { + if (path.extname(assetName).toLowerCase() === '.zip') { decompress = decompress.use(Decompress.zip()); console.log(`[OmniSharp] Unzipping...`); } @@ -129,6 +123,5 @@ export function downloadOmnisharp(): Promise { inStream.pipe(outStream); }); }); - }); }); } \ No newline at end of file