Currently im working on new project using CefSharp.OffScreen.NETCore, but I've got issue running it in Rider. Project building successfully, but on run this exception appears:
System.BadImageFormatException: Could not load file or assembly 'CefSharp.Core.Runtime, Version=107.1.120.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138'. An attempt was made to load a program with an incorrect format.
Then I've tried to build and run it in Visual Studio and after rebuild it runs fine. This issue happens only with CefSharp package, other projects with absolutely different packages runs without any exceptions.
Running configuration is same in Visual Studio and Rider (Debug x64, but tried all available - nothing changes). As I think there is might be problem with Rider MSBuild configuration, it might pass wrong parameters to build project.
I've tried reinstall vc redist, clean project, run project with different configuration (x64, x86, AnyCPU, Prefer 32bit also tried), use "Pass VisualStudio parameters to build" parameter in Rider build settings, create new project with simple CefSharp usage, even run project in both IDEs on absolutely clean PC. Nothing of it didn't help. All packages CefSharp.OffScreen need are installed.
It will be nice to got an example what parameters Visual Studio use, so I can try pass them in Rider.
You have added the nuget package chromiumembeddedframework.runtime.win-arm64 but I'm pretty sure you meant to add x64 :)
I am getting an issue with installing the .NET SDK, at first when I went into visual studio 2019 it said that I was missing the dotnet runtime sdk so I installed it like it asked and restarted my computer. I then went on to visual studio 2019 again, and the same issue arose, I went into my command prompt and typed dotnet --list-sdks and it displayed no sdks. I have all of the runtimes installed, but it says No SDKs were found. image . I tried re-installing the sdks but the same problem stuck. I even went as far as to re-install IIS. I can't do anything without this being fixed please help soon!
Before you try a manual install, I'd check if the Path in the system's environment variables is correctly configured for your system.
Given that there's always one shared host that moves forward, it will either pick the x86 or the x64 version on your machine. This issue of not picking the right one might happen if you install multiple/different versions.
Run the where.exe dotnet command to see where the host is looking for the SDK (it's the first entry returned). If you're on a x64 machine, you want to have C:\Program Files\dotnet listed first.
If it's not, edit the Path system's environment variable to have the location you want showing up higher. Doing that should fix the issue of the SDK versions you installed not showing up when you run dotnet --info.
See The latest installed .NET SDK not found for complete instructions.
Answer above by Maira is correct and fixed the issue however for those that need a little help go to start menu, type "path" and select "Edit the System Environment variables". When that opens, under the "Advanced" tab click "Environment Variables".
Under System Variables find the "Path" variable and click "Edit". Find "C:\Program Files\dotnet" and click "Move Up" so that it is above the (x86) variable.
I managed to find the answer to this problem, and anyone else who is having this problem can most likely fix it with this solution too! So the reason it breaks is because of the way the .NET Core SDK installer works, it does not install the SDK correctly for some reason, so you have to do it manually. Go to this link, where you would normally get the installer for the SDK but rather than downloading the normal version, download the binaries version. It should download as a .zip, so extract it and then copy the contents of the folder. Go to C:\Program Files (x86)\dotnet\ and then remove it's contents, finally paste your clipboard into the folder. Now try it out, open a new command prompt or PowerShell, and type dotnet --info. It should tell you that you have all the SDK's and Runtimes installed. Keep in mind, you will have to download the newest version of the binaries, that way you have the latest version of the SDK's.
The reason this works is that you are manually pasting the SDK's into the folder, if anyone could start a ticket for the installer to Microsoft, {EDIT: MS created an internal ticket and this answer is wrong. See next answer End Edit} that would be great, and link them to this post so that they can understand what's going on. Some of you might have come here because you are fed up with reading Microsoft documentation and to be honest, so was I! Now this might not fix all the problems you are having, for example, I am still having problems with visual studio and their .NET implementation but if I or anyone figures it out, I will add it to this answer. Hope you have a great day, bye!
dotnet do not seem to match well with SDKs / runtimes with 32-bits and 64-bits. If you have both variants and want to only use the 64-bits (or generally, cant list up any SDK-s), you can try this :
Inside folder : C:\Program Files (x86)
Rename folder 'dotnet' to 'dotnet_x68'
Inside a shell (remember to either run command 'refreshenv' from Chocolatey for example to refresh your environment, if you have choco installed.. )
Enter now this command :
dotnet --info
Also list the SDKS :
dotnet --list-sdks
This fixed up my development environment. Note that if you want to use dotnet against x86 system, you might consider to instead uninstall x64 variants of dotnet runtime and sdks as dotnet do not seem to work very good from command line with a mix of them both (and avoid renaming the x86 folder of dotnet of course as suggested above.
I found that I had two program files, One called Program Files (x86) and one called Program Files. I went to Settings, About and looked at my System Type. I have a 64-Bit operating system and so I went into Program Files (x86) and found another dotnet folder. I deleted the dotnet folder and restarted Visual Studio. It Worked after that.
If you get this issue like I did on a ARM based Mac M1 or M2 then do the following.
remove this directory completely /usr/local/share/dotnet
run the installer package again
I believe this issue happened when I accidentally installed dotnet-ef x64 instead of arm64.
When I open my vs code program I get this message:
The .NET Core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path.
If I installed and even uninstalled the .NET core SDK and reinstalled it, there were several ways to change the external terminal to Power Shell, but no changes. Another problem I have when I click on the terminal is this message:
The terminal shell path "; C: \ Program Files \ dotnet" does not exist
If my .NET is on the same path and persists.
Please tell me how can I fix my problem?
Visual studio code : version 1.42.1(x64)
.NET core SDK : version 3.1.101(x64)
And I've tried these .NET core SDK versions:
version 3.0.100(x64) , version 2.2.207(x64)
Just simply close your VS Code app. It seems the error is produced because you are installing .NET Core SDK when your VS Code is opened.
After closing it, re-install the .NET Core SDK.
You must be able to use it now.
It worked for me.
I have the 5.0.103 [/snap/dotnet-sdk/112/sdk] installed (as shown, using snap) on KDE neon (based on Ubuntu 20.04).
In order to inform vs code where to find the .Net sdk, set a symbolic link '/usr/local/bin'(this folder is normally in your path):
sudo ln -s /snap/dotnet-sdk/current/dotnet /usr/local/bin/dotnet
After that, restart Visual Studio Code.
This worked for me.
I'm on a MAC (High Sierra), and closing VSC and reinstalling SDK did not help in my case.
VSC kept saying that SDK was "not installed or not on the path".
When I ran dotnet in the Terminal window I received "command not found" message.
I had to manually add /usr/local/share/dotnet to PATH in my ~/.bash_profile.
Correct path is displayed once SDK is installed (see picture below). I appended it to the PATH in my ~/.bash_profile, reopened Terminal, and it worked. You may have to reload VSC too.
Good luck!
DON'T DELETE ANYTHING BEFORE TRYING THIS!
To my fellow developers, I find a great and easy method!
1- Open VS Code and go to settings from the bottom left corner!
2- Type in #ext:ms-dotnettools.csharp to search dotnet tools!
3- Scroll down until you find "Omnisharp: Dotnet Path" and click Edit in settings.json link!
4- Go to the end of the file and right before } symbol type in "omnisharp.dotnetPath": "YOUR_DOTNET_LOCATION" enter your dotnet path.
note: don't forget to put a comma(,) before your line!
this will show vs code that you have a dotnet installed on your PC!
5- We are not done yet! Last but not least go back to settings and find Omnisharp: Use Modern Net Check the box and close your VS code, after reopening you will see that your VS Code detects dotnet!
Like this post if it worked out for you!!
One last thing! If your VS code detects it but still no snippets for C# you should check if you've set Omnisharp: Use Global Mono to always, if not then select always to enable it.
In my case it helped just to quit VSCode and re-open it (no need to re-install the .NET Core SDK) and the message you mentioned is gone.
Working on Mac M1. I was facing the same issue when I open the project in VSCode. This is how I resolved
Steps:
I quit my VS Code
I reinstalled dotnet SDK
I restarted my project
Initially, when I installed sdk, my VSCode was open, might be that was causing the issue.
I have the same problem,but my problem was cause by duplicate installation.
My solution as below:
1、open cmd, check the info of dotnet, I found it was a old version of 6.0.3,but I am sure I have installed a newest version of 7.0
input
dotnet --info
here is the output message
Host (useful for support):
Version: 6.0.3
Commit: c24d9a9c91
.NET SDKs installed:
No SDKs were found.
.NET runtimes installed:
Microsoft.NETCore.App 6.0.3 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
2、check the path of dotnet,I found there is two different path of dotnet
where dotnet
C:\Program Files (x86)\dotnet\dotnet.exe
C:\Program Files\dotnet\dotnet.exe
3、go to the path I found,it’s clear that "C:\Program Files\dotnet" is the correct path of dotnet
C:\Program Files (x86)\dotnet
C:\Program Files\dotnet
4、edit environment variable,delete or move down the wrong path
environment variable
5、restart VScode,this error will not display anymore
it is not the way to solve this problem but you can do it to have your code run
you can open a command on that directory "; C: \ Program Files \ dotnet" then write this
dotnet run
and your code will automatically run
My issue was I was using .Net version 5 on Apple silicon, when I tried .Net 6 the problem got solved.
I have reinstalled SDK 6 via snap using https://learn.microsoft.com/ru-ru/dotnet/core/install/linux-snap.
Then, I have executed a command:
sudo ln -s /snap/dotnet-sdk/current/dotnet /usr/local/bin/dotnet
from https://github.com/dotnet/core/issues/7627
quit VS code. quit attached program (unity, etc). open originally attached program. Open VS code (assets > open c# project).
For those of you who are on macOS and on M1, and after they closed VS Code and re-installed it, still don't get rid of the error. Try this:
On VS Code, click "Open folder..." and open your user folder. For example my name is Bob and here is the path of my user folder: "Macintosh HD/Users/bob".
Once the user folder is opened, on the left browser panel of VS Code, open those hidden files:
.bash_profile
.zshrc
and at the end of those files, add this:
export PATH="/usr/local/share/dotnet:$PATH"
And save those 2 files.
Basically, it allows apps trying to find .NET SDK to find it in the folder "/usr/local/share/dotnet" which is the default installation folder on macOS Ventura 13.1 (and some previous versions I don't know lol).
To be honest, only one of these two files needs this new line but I'm to lazy to figure out which one.
Restart your Mac and it should work.
my solution to this issue is:
1-you must uninstall all of the services belong to Visual Studio(not Vs Code)
2-uninstall VS Code and folder "AppData\Local\Programs\Microsoft VS Code"
3-download new dotnet core SDK and install vs code
I hope it's done for you
I downloaded the Build tools for Visual Studios 2019 and that seemed to fix my issue on VS Code.
So go to this URL: https://visualstudio.microsoft.com/downloads/
All Downloads -> Tools for Visual Studio 2019 -> Build Tools for Visual Studio 2019
Then of course, download and run, then select "C++ Build tools" and ".NET desktop build tools" and install.
Worked for me, hopefully works for others too.
The same issue happened to me when I installed an extension. The reason was I didn't have .NET Core SDK installed. What I did to get rid of the issue was:
Close VS Code
Install .NET Core SDK
Re-install the extension (in my case)
Start VSCode from your terminal:
code pathToProject
For MacOS, Linux and Windows users alike.
From the Troubleshooting: 'The .NET Core SDK cannot be located.' errors wiki page in OmniSharp's VSCode repo:
If which dotnet produces a PATH, then the .NET SDK was able to successfully modify the PATH, but VS Code isn't picking it up. VS Code attempts to scrape the environment by launching the default shell under the covers. But this process can be fragile. You can attempt to work around this by starting VS Code from your Terminal.
You can try using homebrew
Install homebrew https://brew.sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Close Visual Studio Code
Run brew install --cask dotnet-sdk
If you will have error like this
Error: You have not agreed to the Xcode license. Please resolve this by running:
sudo xcodebuild -license accept
Then
Run sudo xcodebuild -license accept
Repeat brew install --cask dotnet-sdk
Basically my goal was to get dotnet commands working on terminal on VS code.
For that I spent an hour or two trying to find a solution. I came across a command "dotnet new console", and If i can execute it in the terminal of VS code I can get it to work. But it doesn't because it couldn't identify what dotnet was in the first place. The dotnet commands only worked on my base/usual cmd that comes with windows OS. So what I did was open my file in windows explorer that gives the error, open terminal in the same folder the project file is in (basically the folder that just popped up), and ran the script ("dotnet new console") without the quotes or brackets. It worked and I could use dotnet commands in the terminal of VS Code.
I have shown some arrows indicating files that weren't there before I ran the command. These files were added after running dotnet new console
Changing System Environment Variable Path from C:\Program Files (x86)\dotnet to C:\Program Files\dotnet fixed the problem for me.
If you are on Mac M1, make sure the package is ARM64. You choose if you want x64 or ARM64 when you download at the page, https://dotnet.microsoft.com/en-us/download/dotnet
This worked for me.
I also added the path to my .bash_profile file
You can find the .bash_profile file in your finder once you allow the showcase of hidden files.
This for future:-
hi Jeeva if you install again unity with vscode please read this
First install vscode extension https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp
If you got error like this "The .NET Core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path" then install https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-6.0.300-windows-x64-installer
If vscode shows "The reference assemblies for .NETFramework,Version=v4.7.1 were not found" on output terminal then install developer pack https://dotnet.microsoft.com/en-us/download/dotnet-framework/net471 then try exit and open vs code if not work then restart
If you absolutely cannot get .NET Core SDK installed so that Omnisharp can find it, try unchecking the checkbox next to "Show Omnisharp Log On Error" under Settings > Extensions > C# Configuration > [] Show Omnisharp Log On Error
Click on the error that is shown on your VS Code
Get into Settings of the error
Download it and you are all set
I installed Visual Studio for Mac and around to build the application for Android it gave me this error. I installed NDK and now this error appears to me.
Do you know how to solve this?
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2873,3): error XA5101: C compiler for target Arm was not found. Tried paths: "/Users/UserName/Library/Developer/Xamarin/android-sdk-macosx/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc; /Users/UserName/Library/Developer/Xamarin/android-sdk-macosx/ndk-bundle/prebuilt/darwin-x86_64/bin/gcc" [/Users/UserName/Projetos/ProjectName/app/src/android/ProjectNameApp.Droid/ProjectName.Droid.csproj]
An error occurred when executing task 'Release-Android'.
Teardown
Executing custom teardown action...
Environment: QA
Configuration: Release
Target: Release-Android
Error: One or more errors occurred. (MSBuild: Process returned an error (exit code 1).)
MSBuild: Process returned an error (exit code 1).
I have already seen several solutions but I can not solve it, I have already installed NDK, I have already validated the folder where it is installed, I have already inserted AndroidNdkDirectory in Droid.csproj and so far none of this has resulted.
There are two potential ways to resolve this issue:
You can switch the Android NDK version to r17 or lower. One way to do that is to un-check NDK from the Android SDK manager (the Tools tab from your screenshot) to uninstall version r19, then select the gear icon from the lower right of the window, pick the Microsoft (Recommended) repository, and check NDK version r17 (which should now appear in the list) to install that version.
Or, if you are working on code where you can use a preview version of Xamarin.Android, you can update to the current preview Xamarin.Android version 9.3.0.19 by switching to the Preview updater channel in Visual Studio for Mac.
Additional info
The current Xamarin.Android SDK version 9.2.3.0 is not yet compatible with Android NDK versions r18 or higher, where GCC has been removed.
Compatibility with those newer NDK versions (and in particular, compatibility with the change from gcc to clang) is included in the preview Xamarin.Android SDK version 9.3.
[Update] I've since compiled successfully and anyone else chasing these binaries can download from here
I'm compiling version 2.06 of lzo by issuing the following command from the Visual Studio Command Prompt (2010)
b\win64\vc_dll.bat
which produces lzo2.dll without any errors, however this doesnt look like it really did produce the 64-bit dll as my 32bit C# app can still reference and call methods (successfully)
How can I compile the 64bit version?
some of the comments on this question may be outdated as the question changed but I since changed it back to the original question when it got more involved so I could mark the response as the answer
Almost certainly you will be using the wrong set of compilers; 64bit compilation isn't controlled by a command line flag - it's a completely different toolset;
Issue the build commands from the "Visual Studio x64 Win64 Command Prompt (2010)" which you will find in the Start Menu\Programs\Microsoft Visual Studio 2010\Visual Studio Tools.
e.g.
c:\> cd /d h:\temp\lzo-2.06
H:\temp\lzo-2.06> b\win64\vc_dll.bat