VSCode: enable .Net Core Debugger in portable IDE - c#

In these days I'm trying these projects:
- Visual Studio Code: I chosethe portable (.zip) executed from USB memory.
- .Net Core (.zip package again), which I decomprissed into the same USB memory as the previous one.
When I try to generate a new C# into VSCode project, first I had the problem around how to invoke the .Net core folder (aka dotnet decomprissed folder). Until now, just I had to put in the console the absolute path location of the dotnet executable -again, from the folder I decomprissed from the zip file-.
But then I try to debug the console application after these commands:
dotnet new
dotnet restore
dotnet build
I see the following error:
The .NET Core Debugger is still being downloaded. See the C# Output Window
for more information.
[ERROR]: C# Extension failed to install the debugger package
How can I solve this?

Just saw this error on my PC too, turns out as of now the C# debugger doesn't support 32-bit Windows system, there is an issue on GitHub: https://github.com/OmniSharp/omnisharp-vscode/issues/844.
Check if you are using a 32-bit Windows, if yes, upgrade to x64.

Related

My program doesn't excute even installed runtime package

I published my program(.net core 3.1 winform program). but it doesnt excuted even installed .net core 3.1 run-time package. so i install .net core 3.1 sdk package, it works.
why i install sdk instead of run-time package?
The software development kit (SDK) includes everything you need to build and run . NET Core applications, using command line tools and any editor (including Visual Studio). The runtime includes just the resources required to run existing
There was a problem creating a single file by using app.config in the wrong way.
When app.config was used in the correct way, it was confirmed that it works normally only with the runtime sdk.
Previously, both *.dll.config and *.dll were required, but after correcting it, only *.dll.config worked normally.

.Net core application cannot run on Linux?

I created a .Net core C# console application in Visual Studio and used the following steps to test it on Linux.
Use Visual Studio "Build -> Publish" menu item to create the executable files in ....\bin\Release\netcoreapp2.1\publish.
Copy the "publish" directory to the Linux machine
On Linux, chmod 777 myApp.dll
./myApp.dll
However, executing the app shows the error of
-bash: ./myApp.dll: cannot execute binary file
It looks like you did a Framework-Dependendent Deployment. Essentially, the publish command was:
dotnet publish -c Release
FDD assumes that you are going to have a .NET Core runtime to run your application on the target platform.
Once you copied over the publish directory to another machine (which could be Linux, macOS or Windows), your application still needs a .NET Core runtime to run your application.
Installing the .NET Core runtime depends on the particular Linux distribution that you are using. Once you have it installed, you can run your application by doing:
dotnet /path/to/publish/myApp.dll
An alternative to Framework Dependent Deployment is Self-Contained Deployment. In this mode, the published application will contain your application as well as a copy of the .NET Core runtime. On command line, doing a a SCD publish looks like this:
dotnet publish -r linux-x64 -c Release
For doing this in Visual Studio, see the link above. Then, you should see a bin\Release\netcoreapp2.1\linux-x64\publish\ directory that contains a myApp file. You can copy over this publish dir over to a Linux distribution and just run:
/path/to/linux-x64/publish/myApp

Unable to Build and Run DotNet Core from VS 2017

Issue
I have been unable to build and run any dotnet core application from Visual Studio 2017 (15.5.2). Every time I attempt to run it, VS2017 immediately goes into Break Mode, and stops debugging when I hit continue.
This happens even when I use the New Project from VS2017 and choose a .NET Core template (Console App or ASP.NET Core Web Application).
I have followed Microsoft's directions at Build a C# Hello World app, and have completed the instructions at Prerequisites for .NET Core on Windows.
What I Have Tried
Uninstalling and reinstalling the .NET Core cross-platform development workload in VS2017.
Removing all .NET Core SDK versions from Programs and Features and reinstalling from .NET Core 2.x SDK
What I Can Do
Navigate to the source directory and run dotnet run in Powershell. This successfully runs the application in the terminal.
If I guess the dotnetcore PID correctly, I am able to attach to the running process in VS2017.
Open the project in Visual Studio Code. After VSCode creates the build configurations, it is able to build and debug the code.
I do a majority of development in VS2017, and would prefer to use it for dotnet core as well.
dotnet restore
is very likely to be your best friend. If any files are missing they can be easily recovered in this way. For example, when I created a new VS2017 ASP.NET project I kept getting "System could not be found" errors throughout until I executed the restore command, and now I am on my way. Have you tried that?

.NET Core 2.0 Build not including dependencies

When I build my .NET Core 2.0 console app, I move it over to the server and I then try and run it. I am getting the error "An assembly specified in the application dependencies manifest..."
I add the dlls to the local folder that it is searching for, but it ends up still needing system dlls like Data.SqlClient.
How do I build the project where it includes all the dependencies in the output files? I've published the project with Visual Studio 2017, however, it still says things are missing when I copy all those files over. I've tried building and publishing with VSCode and have the same problem.
I faced a similar problem. When I deployed my application in host environment and executed with dotnet command like "dotnet myapp.dll" it worked fine using the host environment's .NET Core runtime.
But when I packaged the same application as a Standalone application with an .exe file included to start the application, I faced this error for Newtonsoft.json Nuget Package when .exe file is executed.
My observation is as below, and I was able to solve the problem accordingly.
Framework-dependent deployment:
If the application uses third-party libraries and intention is to use the .NET Core runtime in the host environment, then the checkbox in the "Manage Packages for Solution" has to be checked in the Nuget Package Manager (as shown in the screenshot).
Self-contained deployment:
If the published application is supposed to be a stand alone application in the host environment (even with an .exe file), then the application's .csproj file should include the RuntimeIdentifiers (.NET Core RIDs) specified. Also the third party libraries have to be included in PackageReference. For example,
Reference: https://learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-vs
You need to publish the application to have all the dependencies included

.net core console run as x86 on x64 system

Create via VS2017 preview a .net core 2.0 console app.
Run it, x64, no problem.
Switch properties-> build -> platform to x86
Run it, run hangs and gets nasty message about it not working.
Drop out to command prompt
Navigate to directory where project is
Delete bin and obj
dotnet restore
dotnet run
Get a System.BadImageFormatException.
Any ideas how to build and run this? Tried installing 32bit framework, no go.
1.Install x86 DotNET core run time on your machine. its default location is
C:\Program Files (x86)\dotnet
2.update your web.config file
make sure the process path point to x86 version DNC
Install dotnet X86 Runtime from https://dot.net

Categories