1

I want to use vsCode as the script editor for the Unity. Therefore, I've installed the dotNet Framework by the link from vsCode output. https://aka.ms/msbuild/developerpacks

Also, I've installed

  1. Mono
  2. TargetingPack

I still get the warning, however, when I opened the script from the Unity.

Do I need to reinstall something, or I missed something to make it right? Any help is highly appreciated.

Here is my output

Starting OmniSharp server at 2020/7/25 下午12:19:07
Target: d:\Unity\MyFirstGame\MyFirstGame.sln

OmniSharp server started.
Path: c:\Users\alex0\.vscode\extensions\ms-dotnettools.csharp-1.22.1\.omnisharp\1.35.3\OmniSharp.exe
PID: 12524

[info]: OmniSharp.Stdio.Host
    Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
    DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    Located 1 MSBuild instance(s)
        1: StandAlone 16.4 - "c:\Users\alex0\.vscode\extensions\ms-dotnettools.csharp-1.22.1\.omnisharp\1.35.3\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    MSBUILD_EXE_PATH environment variable set to 'c:\Users\alex0\.vscode\extensions\ms-dotnettools.csharp-1.22.1\.omnisharp\1.35.3\.msbuild\Current\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    Registered MSBuild instance: StandAlone 16.4 - "c:\Users\alex0\.vscode\extensions\ms-dotnettools.csharp-1.22.1\.omnisharp\1.35.3\.msbuild\Current\Bin"
        CscToolExe = csc.exe
        CscToolPath = c:\Users\alex0\.vscode\extensions\ms-dotnettools.csharp-1.22.1\.omnisharp\1.35.3\.msbuild\Current\Bin\Roslyn
        MSBuildExtensionsPath = c:\Users\alex0\.vscode\extensions\ms-dotnettools.csharp-1.22.1\.omnisharp\1.35.3\.msbuild
        MSBuildToolsPath = c:\Users\alex0\.vscode\extensions\ms-dotnettools.csharp-1.22.1\.omnisharp\1.35.3\.msbuild\Current\Bin
[info]: OmniSharp.Cake.CakeProjectSystem
    Detecting Cake files in 'd:\Unity\MyFirstGame'.
[info]: OmniSharp.Cake.CakeProjectSystem
    Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
    Detecting projects in 'd:\Unity\MyFirstGame\MyFirstGame.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
    Queue project update for 'd:\Unity\MyFirstGame\Assembly-CSharp.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
    Detecting CSX files in 'd:\Unity\MyFirstGame'.
[info]: OmniSharp.Script.ScriptProjectSystem
    Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectManager
    Loading project: d:\Unity\MyFirstGame\Assembly-CSharp.csproj
[info]: OmniSharp.WorkspaceInitializer
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.WorkspaceInitializer
    Configuration finished.
[info]: OmniSharp.Stdio.Host
    Omnisharp server running using Stdio at location 'd:\Unity\MyFirstGame' on host 10864.
[fail]: OmniSharp.MSBuild.ProjectLoader
    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
[warn]: OmniSharp.MSBuild.ProjectManager
    Failed to load project file 'd:\Unity\MyFirstGame\Assembly-CSharp.csproj'.
d:\Unity\MyFirstGame\Assembly-CSharp.csproj
c:\Users\alex0\.vscode\extensions\ms-dotnettools.csharp-1.22.1\.omnisharp\1.35.3\.msbuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1177,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

[fail]: OmniSharp.MSBuild.ProjectManager
    Attempted to update project that is not loaded: d:\Unity\MyFirstGame\Assembly-CSharp.csproj

and I also get this when opening the script:

Looking for git in: C:\Program Files\Git\cmd\git.exe
Using git 2.27.0.windows.1 from C:\Program Files\Git\cmd\git.exe
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git

1 Answer 1

1

I've found the solution for this. Due to the default setting for the Unity to target the dotNet Framework version is 4.7.2, just change it to the version which is using now. For example, my framework version is 4.8.

Therefore, at the left toolbar in the VScode, there is a file called Assembly-CSharp.csproj when you open the script from the Unity. Click into the file and find the <TargetFrameworkVersion>. You'll see the default version 4.7.2. Then, change to the version you're using. That's all. Another of doing it is installing the version 4.7.2.

Note this is an issue after I installed all the necessary programs.

  1. Mono https://www.mono-project.com/download/stable/
  2. DOTNET framework and core SDK https://dotnet.microsoft.com/download
  3. Extension for C# and the Unity https://code.visualstudio.com/docs/other/unity

EDIT If the series of problems cannot be solved using VSCode, I would suggest using Visual Studio. It's all packed without any bugs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.