Code-Runner: /bin/sh: cscript: command not found - c#

I'm on Linux and currently trying to run a simple Hello World-program in C# using visual studio code.
The VSC for Linux, Arch Linux to be precise, is 'code'. I installed the extension 'Code Runner', but everytime I click on the 'Play/Execute'-Button in the upper right corner, it says:
[Running] cscript "/path/to/my/file/learning.cs"
/bin/sh: cscript: command not found
I can compile it with csc learning.cs and executing it with mono learning.exe just fine, but the built in code-runner VSC extension does not seem to work. I thought about adding 'cscript' to PATH but I don't know where it is located at.
I read on here that this problem exists for quite some time now, maybe someone found a solution? Or I am just really blind or dumb for not seeing an obvious fix.
Any help is greatly appreciated.

Fix:
in vscode, go to preferences, then settings. Type Code-runner: Executor Map
Click Edit in settings.json
Under "code-runner.executorMap":
replace
csharp: cscript
with
csharp: dotnet run

Related

Starting a Process Post Build in IntelliJ Rider

im trying to start a Process after my Build finishes in IntelliJ Rider but not have the Builder attach to it.
I am currently using:
start [Program Path]
I have tried:
Adding the /b flag
using '&' after the command
It seems very Difficult to get any answers on the Topic of Post/Prebuild commands especially when it comes to Rider. Any help is greatly apreciated

You don't have an extension for debugging C#, Should we find a C# extension in the Marketplace?

I'm trying to debug a C# script using VSCode. but when I hit F5 it shows
But I do have the C# extension installed in VSCode
About my VSCode
Version: 1.56.2 (system setup)
Commit: 054a9295330880ed74ceaedda236253b4f39a335
Date: 2021-05-12T17:13:13.157Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.19042
I also have Dotnet installed on my machine
dotnet --version
5.0.203
Previously, VSCode used to resolve all the necessary dependencies and create the necessary files for debugging a C# script. Maybe the latest update has some issues?
If you have issues with that I suggest going to 'view' and then press command pallet or press Ctrl+Shift+P and then search 'generate assets for build and debug' and if you want it to open up a new window and execute your code instead of it running in the terminal:
Go open .vscode
Then select launch.json and then go to where it says console and write this instead:
"console": "externalTerminal",
Is there a .vscode folder in the folder you are working out of or in a parent folder? Not having that will cause issues with VS-Code loading extensions.
Did you open VS-code by clicking on a source code file in File Explorer? If so then VS-Code is currently unaware of your .vscode folder for that project.
Either way the solution is to open the folder through VS-Code by going to File->Open Folder and select the folder your project is in. In the former case you will also get a message asking you if you want to generate something and you need to click yes on that. This also seems to solve some instances of getting the 'Unable to generate assets' and 'Omnisharp server is not running' errors.

NAnt stops working when I try to run it

I am trying to convert my nunit xml tests to html but I cannot get NAnt running
When I try to launch NAnt manually I get this right away followed by a Nant stopped working pop up:
The First Type of permission failed was: System.Security.Permissions.FileIOPermission
Unhandled Exception: System.Reflection.TargetInvocationException
I get a similar result when I try to start it's proccess in c# which I need to do in the end.
I made a build file from this website and I also tried their steps manually: http://ajeeshvl.wordpress.com/2010/11/16/converting-nunit-xml-test-result-to-html-formatc-seleniumrc-nunit-framework/
I tried moving the build file to the same folder as NAnt.exe and in the downloaded nunit2report file but that didnt make it work either.
It's very confusing to use NAnt and I still can not find Nunit2Report console exe(if there is one) and I've been trying to find clearer steps online.
My NAnt version is 0.92
And I am using Windows 8 as my OS
Thank you
Can you right click on the downloaded zip file for NAnt and unblock it. Then extract it and try. This was the issue I got on Windows 7.
Nunit2Report console exe is a part of nantcontrib. You will have to download it.
http://nantcontrib.sourceforge.net/

Build Failed. See the build log for detail

I create a new project, click compile, and get this error:
Build Failed. See the build log for details.
In the build log there is only this:
Building: FirstProgram (Debug|x86)
---------------------- Done ----------------------
Build failed.
Build: 1 error, 0 warnings
Here is what I see:
What causes this error and how do I fix it?
Lots of times dealing with this error. I just closed and reopened. It happens every time I add a solution and then delete it. I think Xamarin Ide is not a really good Ide, not in Mac at least.
In my case, i did`t Indy (or higher) License.
When i started trial period, the problem was solved.
I got the same error when trying to build. Without having noticed I had been logged out of my account, which caused the error. Curious that I wasn't prompted to relog or given information that I wasn't logged in.
Though this is an old post, maybe this could help someone.
In my case, using Xamarin Studio 6.1.4 (build 1), I unchecked
the 'Use MsBuild engine ...' check box under Project Options > Build > General and
the problem disappeared.
I searched for solution online for similar problem, but none solved my problem, then I tried this:
Tools >>> Options >>> Projects and Solutions >>> Build and Run
Then I changed MSBuild output and MSBuild log to Detailed.
Rebuild and the error message will show.
cd into the project path, and hit msbuild on it.
You will then see the error details in the console STDOUT.
I had the same problem after upgrading Xamarin, and in my case it happened even for a x86/desktop Console Application. Turned out to be because I didn't have 4.5.1, which was required by the newer version (I had only 4.5 I think).
I found this entry in the log:
Unregistered TargetFramework '.NETFramework,Version=v4.5.1' is being requested from SystemAssemblyService, returning empty TargetFramework
After googing this error I found https://stackoverflow.com/a/38102386/492336, and the solution was to download .NET 4.5.1 and it worked after that!
I just ran into the same problem using Visual Studio Community for Mac. The system was out of disk space. Freeing up some disk allowed a build to complete successfully.
Try the following options from Build menu:
Clean All
Rebuild All
Then build it again.
If won't help, check your log files for details by going to Help menu and Open Log Directory.
For example by dragging & dropping the log folder into newly opened Terminal window, and run:
tail -f *.log
then run the build again and check the reported logs. Hit Control-C on Terminal when finished.
For better visibility, run:
tail -f *.log | grep -C5 -i error
You can also try to clear cache folder of VisualStudio, e.g.:
$ lsof -p $(pgrep VisualStudio)
$ rm -fr ~/Library/Caches/com.microsoft.visual-studio
I downloaded and installed the packages shown below in the order listed:
JDK 1.6: http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u31-download-1501634.html Please choose the jdk-6u31-windows-i586.exe installer from the list above.
Android SDK: http://dl.google.com/android/installer_r20-windows.exe After the main installer is done, please open the SDK Manager and install the following platform APIs: 7,8,10,12,14
Mono for Android SDK: http://download.xamarin.com/MonoforAndroid/Windows/mono-android-4.4.55.104956787.msi
Reboot Xamarin.
Try building your project from the Powershell command line.
dotnet build
Then, build errors will appear in the command line output.
I encountered this issue today in Visual Studio for Mac 2022 with a Xamarin Forms 5 project. In my case, going to the Solution properties, under Build → General, and unchecking "Build with MSBuild on Mono" worked.
(This might be similar in spirit as #JackGriffin's answer, but it seems to be a solution property rather than a project property.)

EAZfuscator not working automatically

I have a C# 2010 WinForms application using .Net Framework 4.
I am using Eazfuscator.NET to obfuscate this application. If I obfuscate the executable manually, everything works fine.
When I try to make the program obfuscate itself on every build by dragging the project onto the green part, everything works fine and this is output:
Protecting project 'Roster Manager.csproj'... done
Protected project will be obfuscated automatically during the build in Release configuration
Please restart Visual Studio to complete the installation of Eazfuscator.NET
After that, I close VS, start it again, clean the solution, rebuild it and run it. The program works but it is not obfuscated, as proved by decompiling it using Reflector 7.
I am building it in Release as requested by the program.
Searching the web didn't help so maybe if someone ran into this problem before might have a fix to this issue.
Eazfuscator add this line to the PostBuildEvent (Word Wrapped for legibility, but it is one line) of your project. (Right click on Project -> Properties -> Build Events.)
if /I "$(ConfigurationName)" == "Release" Eazfuscator.NET.exe "$(TargetPath)"
--msbuild-project-path "$(ProjectPath)" --msbuild-project-configuration "$(ConfigurationName)"
--msbuild-project-platform "$(PlatformName)" --msbuild-solution-path
"$(SolutionPath)" -n --newline-flush -v 3.2
Check if it is present and if your release configuration is really called "Release".
Finally managed to fix it. Seems that disabling the User Account Control resolves the issue.
A quick Google search will give more details into how to do this.
If you're using a version control system like TFS, .csproj file may be locked.
So you'll have to unlock file by checking it out or unchecking "Read-only" box from file properties.

Categories

Resources