Maxime FRAPPAT

Hum …no thanks ! – Lordinaire

Tag: Visual Studio

Work with Docker in Visual Studio 2017

Docker is a well-know tools in Microsoft ecosystem since few years. You can of course doing great things if you deal with Azure but it isn’t limited to “ops”. Developers can now easily play with Docker inside Visual Studio with some additional tools. Stuff like starting a container becomes so easy that everybody must use it! (I like Docker, a lot!)

Setup & Tools

First, you need to download and install Docker for Windows and select the .NET Core option in the installer of Visual Studio 2017.

Bonus: You can additionally download Kitematic (Visual Docker Container Management) if the CLI is not your friend.

Project sample

Let’s create a new ASP.NET Core 2.0 project of type WebAPI. The main benefit to target a .NET Core project is that it can run on Windows AND Linux platform.

Docker for Windows is able to run both of platforms type for a container but not a mixed use of it. So, you need that all your containers target the same platform, you can’t set a specific platform for a container. That’s the only limitation that I face off (and it can be a huge one…).

You can check the Enable Docker Support now or add it after when the solution will be created. If you doesn’t set the option, le solution explorer looks like that :

To activate the Docker support, right clic on the project and select Add > Enable Docker Support. Visual Studio will now automatically create a new project named docker-compose and a Dockerfile in your project. Well, thank you VS.

Dockerfile

FROM microsoft/aspnetcore:2.0
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "WebApplication1.dll"]

docker-compose.yml

version: '3'

services:
  webapplication1:
    image: webapplication1
  build:
    context: ./WebApplication1
    dockerfile: Dockerfile

Start the project

Before starting the project, we need to check if the shared drives settings are set properly because Docker required full access to drives where the source code.

To run your project with Docker, you need to set the docker-compose project as startup project. Hit F5 and open the console window : you will see all the steps like downloading the image, creating the container, …

Bonus: You can add breakpoints like you always do and it will work!

Bonus 2: If you launch Kitematic you will see your container with all his settings

 

 

 

[Unity] Visual Studio Tools for Unity 2.0

The Microsoft team in charge of the tooling for Unity has just released version 2.0 of Visual Studio Tools for Unity. For those who do not use Visual Studio as IDE (guys … really ?!), take a few minutes to try this awesome product!

Here is an overview of what you can achieve with this tool:

  • Debug your game on VS (breakpoints, exceptions, …)
  • Create scripts (MonoBehavior …)
  • Errors on the Unity editor are linked to the VS error window
  • Code Coloration for Unity’s shaders (VS 2015 only)
  • Resharper :)

For more information, see the official post : http://blogs.msdn.com/b/visualstudio/archive/2015/07/27/visual-studio-tools-for-unity-2-0.aspx

Have fun!

Powered by WordPress & Theme by Anders Norén

%d bloggers like this: