On a clean ubuntu 20.04 installation I installed the Swift compiler, Visual Studio Code, downloaded the sourcekit-lsp and installed the plugin I build from it into Visual Studio Code.
Swift version 5.2.4 (swift-5.2.4-RELEASE) Target: x86_64-unknown-linux-gnu
Everything seems to work as expected, except for classes that are in different files, which are not recognized within VSCode:
use of unresolved identifier 'Calculator'
However, when building and running the application, everything is fine and works as expected.
Multiple people in the past seem to have had the same issue, but I have so far been unable to find any answer to how I might resolve the issue.
Related
Sorry, I'm a newbie here. I've spent a few hours now trying to get intellisense to work on VS code and have followed multiple Youtube guides. No luck. I've installed and uninstalled everything multiple times. I keep getting this message.
F:\Program Files\dotnet\sdk\6.0.401\Microsoft.Common.CurrentVersion.targets(1220,5): Error: The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
It tells me to install the developer pack, but it already is installed? Any idea of how to fix this? Please help.
Primarily, this has to do with the VS code extensions and Installation of the Unity editor on Unity HUB.
In VS code, install the extension: C# for Visual Studio Code (powered by OmniSharp).
While installing the unity editor through Unity HUB, make sure you are installing Microsoft visual studio community.
I'm creating a MAUI application targeting iOS and Android. I have been using Visual Studio 2022 for Mac version 17.3. That version doesn't really support archiving the app, so I installed version 17.4 preview 2.1. When I try to compile my app I get the following error:
Unable to find Microsoft.NET.Runtime.MonoAOTCompiler.Task
I found a post that indicated I should run the command:
dotnet add package Microsoft.NET.Runtime.MonoAOTCompiler.Task --version 7.0.0-rc.2.22472.3
When I run that command in terminal I get the error:
error: Value cannot be null. (Parameter 'version')
Everything I have found indicated that the problem should have been fixed in Preview 2.1 of Visual Studio 2022 for Mac, but it is still occurring.
Can anyone help me resolve this? I need to publish my app to the stores and can't get it to compile in release mode or create the archive because of that.
You need to add the package to your project.
First, you should right click your project name and choose the Manage Nuget packages button.
Second, you can search the package Microsoft.NET.Runtime.MonoAOTCompiler.Task and install it.
Then you successfully add the package to your project.
I have a clean install of Ubuntu 20.04 LTS. I want to install Visual Studio Code, .NET SDK 5.0, and what seems to be the best suggested C# extension, this, the OmniSharp one.
I first tried to install with the Ubuntu Software app. In Visual Studio Code I installed the suggested OmniSharp extension. When trying to build a project, I got the mentioned error.
I tried installing using the terminal with this tutorial which seems good and straighforward - same error, when at the console app example stage after running dotnet new console.
This SO question has three proper suggestions, though I would like to use the latest SDK, and I do not have Mono installed, also I want to use Visual Studio Code, as far as I know, that is a newer approach than Mono.
The omnisharp.path": "latest solution does not work.
i faced the same problem and in the end i find the solution here
https://medium.com/#stnlyli/visual-studio-code-failed-to-load-c-extension-on-ubuntu-5cc56dd1cdb7
prefix:
file->preferences->settings-> search for "Omnisharp: Use Global Mono" and make it never
Using Unity 2018.3.X just installed does not let you use Visual Studio Code nor MonoDevelop to code right.
Precompile is disabled
No debugger
No autocompletion
Errors everywhere
I solved it myself with some hours dedicated to this thing.
I was installing Visual Code as usual on a new computer but when trying to edit code the autocompletion did not work, also tons of errors popped.
When I installed I added the normal plugins for Unity in Visual Code
C#
Unity debugger
When reloading Visual Code, the Omnisharp log said that the compiler did not find the .NET Framework 4.5 and anything works within your C# scripts.
When looking into it I found this folder in Windows.
(If someone knows where it is in iOS share it please)
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework
That folder showed folders with the versions of the frameworks installed.
In my case, those were 3.0 and 4.5.2.
The problem is that for some reason it does not detects the version 4.5.2 as 4.5 so to fix it normally you should install version 4.5, the problem is that you cant get it anymore.
To solve this, look at the Omnisharp log and change the folder name to the one your Omnisharp says, in my case I changed the name of 4.5.2 to 4.5 and my problem was solved.
I have seen more cases where the version the Omnisharp wants is different, just download the 4.X version you want from this link and change the folder name if you need.
https://dotnet.microsoft.com/download/visual-studio-sdks
Keep you .NET Core updated too to avoid more problems.
I'm beginning in Swift development (server side, no iOS). I have created the minimal package with swift package init and then swift build.
So far, so good. Now, when I run swift test, I get this error:
cannot load underlying module for 'XCTest'
I'm not using XCode, but just Visual Studio Code. How can I solve it? I have seen some solutions using XCode but I didn't found anything for "standalone" projects
Even if you're not using Xcode's editor, you still need the tools that come with it. Make sure you keep everything up-to-date, as the language is still evolving.