I'm using Visual Studio 2017 to create a .Net Core Console application. I want to host this application as a Docker container (for Linux). As soon as I add the Docker support to the project, Visual Studio will run the debug within Docker, which I guess is nice since I can make sure the application behaves similar to production.
However, when debugging this way, i loose the ability to do edit/continue and basic debugging capabilities such as "Set next statement". Is there some way to get these capabilities for a Docker console app, or alternatively run the console app as a normal .Net core app while developing and only switch to Docker for some final testing?
Related
My build machine needs to:
clone repo
build solution
deploy app
run app
UWP app needs to be deployed in OS, I cannot just run DLL. How can I deploy the app, so it can be consumed by WinAppDriver?
As I understand app needs to be i.e. visible in start menu. I could generate bundle and install it using powershell, but I think this is not a right way as visual studio can do it without generating bundle.
My scenario is that I have Visual Studio 2017 running on Windows and all the sources are stored locally on the same Windows machine and I want that code to be shipped to a remote Linux machine, compiled there, run there and remote debugged there.
With proper configuration I can create a CMake C++ project and have it run and remote debugged on remote Linux machine right out of the box. Can I have the same for a .NET Core project with C# code?
I found this question which implies that I could run dotnet publish and maybe also use "attach to process" then but that doesn't look a straightforward as just selecting a startup item and clicking "Play" in a CMake project.
Can I have the same experience of remote starting and debugging my C# code on remote Linux machine as it works in case of CMake C++ projects in Visual Studio 2017?
Can I have the same experience of remote starting and debugging my C#
code on remote Linux machine as it works in case of CMake C++ projects
in Visual Studio 2017?
I'm afraid the answer is negative. For now, the remote-debugging experience in Linux for .net core is quite different from that for C++. It would be a bit more complex when configuring remote debugging in Linux for .net core projects.
You can't simply select the startup item and click "play" like what you did in CMake C++ projects.
Instead you do need to configure the Attach to Process in VS after you start the .net core application in Linux .(dotnet publish command is not necessary, you can use the Publish option in VS, and then copy the output publish directory to a directory with execute permission on the Linux Test VM)
Assuming the .net core you mentioned above indicates asp.net core, please check Debugging ASP Core on Linux with Visual Studio 2017 for more details about how to configure the environment to get a start. Hope it helps :)
Basically, my school only has Mac computers, however they're telling me to learn C# and to do so using Visual Studio. However, the school program is fairly new and the projects are self-guided. I've been coding in C# using Visual Studio and it's been working so far - it's run successfully and everything. However, I can't seem to find a way to export or publish my code into a standalone application. I've tried using WineBottler to convert the .exe into a .dmg, but I can't seem to make it work.
How should I do this? Moving to Windows or another IDE/compiler isn't an option. I've currently been creating my projects in a Console App, but I could change that if necessary.
After quite a bit of experimentation and research, I've found that while you can publish a .NET Core Console App within Visual Studio for Mac, the feature is not supported within the GUI of the program (for whatever reason).
In order to publish, you have to Control-Click on the solution in the Solution Explorer and open the project in the command line by clicking Tools > Open In Terminal.
Once there, type in the command:
dotnet publish -c Release --framework netcoreapp2.1 --runtime osx-x64
This will create a self-contained program for 64-bit mac os on the v2.1 .NET Core framework. The runtime can be changed for different operating systems and the version number for netcoreapp can be changed based on which version you're using and what is compatible with any plugins for your program.
The final product will be found in yourprojectfolder/yourprojectname/bin/Release/netcoreapp2.1/osx-x64/publish
You should have no issues creating and compiling .NET CORE console apps using a Mac. These apps will have limited .NET functionality, do not have .exe files, and are platform agnostic. Here is a quick guide you can reference to decide if .NET CORE is the right option for you.
If you are trying to create WinForm apps or something similar, you cannot do this on a Mac. There are "work arounds" using Wine or other tools, but my experience with those options has been suboptimal at best. If you need to create apps like this, then your best option is to program on a Windows machine. Perhaps ask your school to enable bootcamp and install Windows 10 OS on one of the Mac machines.
You can generate exe using the terminal if you are on OSX. You can follow this post
It requires :
Visual Studio For Mac
A .cs file
Few lines in terminal
I have recently tried to do some C# development on my Linux box with the help of the docker image microsoft/dotnet which works great within the docker image.
Yet I would like to use Visual Studio Code with the C# extension powered by OmniSharp to get intellisense/autocompletion, and the other benefits of that extension within that editor.
The problem is that .NET Core is not supported on my distribution (Arch). There is an AUR package but it has been more often broken than working and I would rather stick with my docker image to run dotnet in a container.
Hence my question is: can I make Visual Studio Code's C# extension which is running on my host OS use the dotnet tools available in the docker image?
Thanks
Yep, you can hook your C# code in the container via Docker Volumes. Try something like this:
docker run --name app -d -p 5000:5000 -v <your-project-path>:/app microsoft/dotnet
Note: Make sure that you are using the .NET Core SDK image.
I'm looking to move an ASP.NET Core application into Visual Studio Team Services for continuous integration and continuous deploy. My application is currently built and deployed "manually":
Build by "publishing" to Web Deploy package in Visual Studio.
Apply DB-migrations (implemented using Simple.Migrations) by running a console application (built along with te web app in step 1) on the target server.
Deploy the built web app using Web Deploy on target server.
And now I would like to automate this process using Visual Studio Team Services. Building the web app (step 1) and deploying it to an Azure App Service (step 3)seems pretty straight forward. But I'm not sure how to apply my Simple.Migrations database migrations (step 2). Is it possible to run a console application (built along side the web app during the build phase) in the deploy phase? A task for running command line scripts certainly exists but I'm not sure what you can actually do with it.
Note that I would like to use the hosted agent (if that makes any difference).
There is a built-in task called: Deploy: PowerShell on Target Machines. This task uses Windows Remote Management (WinRM) to access on-premises physical computers or virtual computers that are domain-joined or workgroup-joined. This task can run both PowerShell scripts and PowerShell-DSC scripts.
Not sure if you could put your console application code in a ps script or directly Run a C# .cs file from a Powershell Script . Another way is using PowerShell run DB migrations. A sample for your reference: Use PowerShell to Migrate SQL Server Instances (db, logins, jobs, etc)