Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity Project have some trouble. #2088

Closed
NakOh opened this issue Mar 5, 2018 · 44 comments
Closed

Unity Project have some trouble. #2088

NakOh opened this issue Mar 5, 2018 · 44 comments

Comments

@NakOh
Copy link

NakOh commented Mar 5, 2018

Environment data

dotnet --info output:

Product Information:
 Version:            2.1.2
 Commit SHA-1 hash:  5695315371

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.2/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.3
  Build    : a9190d4a75f4a982ae4b4fa8d1a24526566c69df

VS Code version:

Version 1.20.1(1.20.1)

C# Extension version:

1.14.0

Steps to reproduce

Open Project ->

2018-03-05 9 42 58

Expected behavior

Don't Error

Actual behavior

Log :

Starting OmniSharp server at 2018-3-5 09:42:49
    Target: /Users/minsookim/GitHub/PlayHoldemClient/PlayHoldemClient.sln

OmniSharp server started wth Mono
    Path: /Users/minsookim/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/OmniSharp.exe
    PID: 1766

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.13.2 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Mono 15.0 - "/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin"
            2: StandAlone 15.0 - "/Users/minsookim/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Mono 15.0 - "/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin"
            CscToolPath = /Users/minsookim/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/Users/minsookim/GitHub/PlayHoldemClient'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Users/minsookim/GitHub/PlayHoldemClient
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/Users/minsookim/GitHub/PlayHoldemClient/PlayHoldemClient.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp-firstpass.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp-Editor.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp-Editor-firstpass.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/minsookim/GitHub/PlayHoldemClient'.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp.csproj
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Stdio.Host
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/Users/minsookim/GitHub/PlayHoldemClient' on host 1744.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp-firstpass.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp-firstpass.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp-Editor.csproj
[warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Assembly-UnityScript-Editor-firstpass.csproj' does not exist.
/Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp-Editor.csproj

[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp-Editor.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp-Editor-firstpass.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/Users/minsookim/GitHub/PlayHoldemClient/Assembly-CSharp-Editor-firstpass.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Assembly-CSharp
[warn]: OmniSharp.MSBuild.ProjectManager
        Unable to resolve assembly '/Users/minsookim/GitHub/PlayHoldemClient/Temp/bin/Debug/Assembly-CSharp-firstpass.dll'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Assembly-CSharp-firstpass
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Assembly-CSharp-Editor
[warn]: OmniSharp.MSBuild.ProjectManager
        Unable to resolve project reference '/Users/minsookim/GitHub/PlayHoldemClient/Assembly-UnityScript-Editor-firstpass.csproj' for 'Assembly-CSharp-Editor'.
[warn]: OmniSharp.MSBuild.ProjectManager
        Unable to resolve assembly '/Users/minsookim/GitHub/PlayHoldemClient/Temp/bin/Debug/Assembly-CSharp-Editor-firstpass.dll'
[warn]: OmniSharp.MSBuild.ProjectManager
        Unable to resolve assembly '/Users/minsookim/GitHub/PlayHoldemClient/Temp/bin/Debug/Assembly-CSharp-firstpass.dll'
[warn]: OmniSharp.MSBuild.ProjectManager
        Unable to resolve assembly '/Users/minsookim/GitHub/PlayHoldemClient/Temp/bin/Debug/Assembly-CSharp.dll'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Assembly-CSharp-Editor-firstpass
[warn]: OmniSharp.MSBuild.ProjectManager
        Unable to resolve assembly '/Users/minsookim/GitHub/PlayHoldemClient/Temp/bin/Debug/Assembly-CSharp-firstpass.dll'
@NakOh
Copy link
Author

NakOh commented Mar 5, 2018

Occurs after updating to the latest VS Code.

@rchande
Copy link

rchande commented Mar 7, 2018

@NakOh If you dotnet build your project, are there any errors?

@DustinCampbell
Copy link
Member

This looks like a Unity project rather than a .NET Core project, so I'd expect dotnet build to fail.

@NakOh: Have you tried building your Unity project?

@aohajin
Copy link

aohajin commented Mar 16, 2018

@DustinCampbell building the unity project will not help.

@DustinCampbell
Copy link
Member

@aohajin : Why would it not help? Based on the error, my assumption is that the project is expecting to find a binary on disk that isn't present.

@NakOh
Copy link
Author

NakOh commented Mar 20, 2018

How to build dotnet Build?

.NET Core용 Microsoft (R) Build Engine 버전 15.5.179.9764
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1011: 사용할 프로젝트 또는 솔루션 파일을 지정하십시오. 이 폴더에 프로젝트 또는 솔루션 파일이 두 개 이상 있습니다.

It's korean.

It means. One More Project or Solution in Folder

And

.NET Core용 Microsoft (R) Build Engine 버전 15.5.179.9764
Copyright (C) Microsoft Corporation. All rights reserved.

/Users/minsookim/GitHub/PlayHoldemClient/PlayHoldemClient.sln : 솔루션 파일 error MSB5004: 솔루션 파일에 이름이 "PlayHoldemClient"인 프로젝트가 두 개 있습니다.

빌드하지 못했습니다.

/Users/minsookim/GitHub/PlayHoldemClient/PlayHoldemClient.sln : 솔루션 파일 error MSB5004: 솔루션 파일에 이름이 "PlayHoldemClient"인 프로젝트가 두 개 있습니다.
경고 0개
오류 1개
It means Two Project in same file...

@DustinCampbell
Copy link
Member

@NakOh: @rchande's suggestion won't work. Building a Unity project with dotnet build will not work. Have you tried building it with xbuild from your Mono installation?

@NakOh
Copy link
Author

NakOh commented Mar 21, 2018

If i xbuild -> msbuild .

2018-03-21 9 21 59

2018-03-21 9 22 09

@aohajin
Copy link

aohajin commented Mar 21, 2018

@DustinCampbell because the dll required was not at the place where omnisharp thought it should be..
for my case
image

but Unity(5.6.5f1) actually put the dll here:
C:\xiimoon\Ngame\Library\ScriptAssemblies\Assembly-CSharp.dll

@Leopotam
Copy link
Contributor

@NakOh did you tried to install mono package from homebrew? If not - try it, unity projects works on my side with dotnet + mono. Looks like this extension will never work as should, better to use old good checked solutions like mono.

@DustinCampbell
Copy link
Member

FWIW, to work with Unity, I recommend installing mono from brew like so:

brew cask install mono-mdk

rather than

brew cask mono

The latter does not include large swaths of Mono, including Mono's msbuild (which OmniSharp will use if present).

@Leopotam
Copy link
Contributor

@DustinCampbell standard mono package was broken half year ago, now it works, I use it instead of cask mono-mdk:

brew install mono

@DustinCampbell
Copy link
Member

it works now? Cool! I haven't looked at it in quite awhile.

@Leopotam
Copy link
Contributor

Leopotam commented Mar 21, 2018

> brew info mono
mono: stable 5.4.1.6 (bottled)

and 2 packages:

brew cask install dotnet
brew cask install dotnet-sdk

@DustinCampbell
Copy link
Member

I just tried brew install mono and it still doesn't include Mono's MSBuild. So, installing the MDK is still needed to allow more project types to work with C# for VS Code. However, if it works for you -- great!

@Leopotam
Copy link
Contributor

Well, it works for unity projects on osx, I dont care about vscode as standalone C# development editor, only as IDE-companion for unity.

@Leopotam
Copy link
Contributor

@DustinCampbell btw, I checked omnisharp log, it filled with warnings too, but no errors and intellisense works correctly.

@NakOh
Copy link
Author

NakOh commented Mar 22, 2018

OK. I installed

brew install mono
brew cask instasll dotnet
brew cask install dotnet-sdk
brew cask install mono-mdk

There was no problem with the original operation, but I was constantly concerned about this warning.

2018-03-22 9 47 17

I will give up and just use vsCode..

@Leopotam
Copy link
Contributor

@NakOh I have only 3 packages installed through homebrew:

mono
cask dotnet
cask dotnet-sdk

With unity 2017.3 i have similar warnings at log: https://gist.github.com/Leopotam/316ccbb113ae191e73618ec432ef3492
But no errors that stops normal execution of this extension.

@NakOh
Copy link
Author

NakOh commented Mar 22, 2018

@Leopotam
Yeah. No Error Yes Warning.
I might ignore this problem.
but I do not want to see the warning.
Why should I look at the warning text that there are no problems?

i want to fix this problem..

@Leopotam
Copy link
Contributor

Leopotam commented Mar 22, 2018

@NakOh I dont remember (I dont see any settings at my prefs about it), but there is "gear" button at notification window, maybe you can tweak this behaviour through some settings there?

@NakOh
Copy link
Author

NakOh commented Mar 22, 2018

@Leopotam
It is only a temporary solution, and I want a fundamental solution.
I hope that OmniSharp's Development Team will be able to solve this problem.

@Leopotam
Copy link
Contributor

@NakOh ahaha, you have the sense of humor :D You can check last year of development in commits list - they fixed only unit-tests support, nothing more. All critical fixes were did by community PRs. So, if you want to see how MS-team works - you will die for age first. If you want to see solution - you should doing it by yourself and make PR.

@NakOh
Copy link
Author

NakOh commented Mar 22, 2018

@Leopotam
I am grateful for the good points and will try to solve the problem.
Thank you~

@rchande
Copy link

rchande commented Mar 22, 2018

Hi @NakOh @Leopotam The warning about project load issues may or may not reflect a problem. OmniSharp raises this warning if there are actual issues loading the project, or if there are MSBuild warnings when building/restoring the project. We plan to fix this via #2110.

You can verify that these warnings are ignorable by building/restoring your project and seeing if there are any warnings or errors. If there are, this is what OmniSharp is prompting for. I agree that this behavior is annoying and that's why we plan to fix it.

@iambumblehead
Copy link

I've been trying to setup vscode for use with an existing project and am having the same issue as @aohajin above.

My system, Darwin x86_64
mono: 5.10.1.47
dotnet: 2.1.4
VS Code C#: 1.15.2

@TheWanderingBen
Copy link

I've been trying to setup vscode for use with an existing project and am having the same issue as @aohajin above.

My system, Darwin x86_64
mono: 5.10.1.47
dotnet: 2.1.4
VS Code C#: 1.15.2

I was just in the same boat, @iambumblehead. I believe if you change your OutputPath in your .csproj files that should fix your problems, though!

@JamesYFC
Copy link

JamesYFC commented Dec 4, 2018

I'm getting the wrong directory issue too. dlls and such are expected to be in temp/bin, are actually in library/ScriptAssemblies instead.

...
I believe if you change your OutputPath in your .csproj files that should fix your problems, though!

@TheWanderingBen I tried this and it worked for a while, until those lines got switched back again in my .csproj files later on the same day :/
Is there a way to make the change permanently?

@MJLeeKor
Copy link

MJLeeKor commented Jan 2, 2019

@NakOh It's so long time ago but for the others,
just using 'Debugger for Unity' extension, since than everything is good.

  • I want to share this, because I took 3days for solving this, bye

@lugehorsam
Copy link

I use Debugger for Unity and still have this issue.

@LoranceChen
Copy link

LoranceChen commented Apr 4, 2019

warning still here after reinstall vscode and mono :-(
image

I'm suppose a reference find fail problem affect by this one.
image
The problem occurred when create a new .cs file and it code reference some existing class.

For detail message:
image

@Leopotam
Copy link
Contributor

Leopotam commented Apr 4, 2019

@LoranceChen its because omnisharp-vscode dev-team dont want to support updating *.csproj files in old format (before .net std) if you will add new *.cs-file right inside vscode. You can fix this behaviour with switching to unity (it should start compilation + *.csproj-files will be regenerated with links to new *.cs-files), then switch back to vscode and run command reload window from command palette. vscode will restart plugins and omnisharp-vscode will get new list of project *.cs-files.
Same behaviour for any new *.cs-files, even created inside unity - you should restart omnisharp-vscode plugin each time on each change on project files list.

@LoranceChen
Copy link

@Leopotam, Thanks. reload window fix the problem. But it's not a normal develop workflow.It seems VS Code not ready for Unity develop yet :-(

@Leopotam
Copy link
Contributor

Leopotam commented Apr 4, 2019

@LoranceChen shit happens, its my standard workflow on osx last 3 years. Custom codestyle formatting - same thing, no any progress from omnisharp-vscode team last 3 years :)
But vs for mac still worse than vscode + omnisharp - slower, consumes more resources, etc.
JetBrains Rider much better with code analytics, but worst IDE for performance reasons. But it will be my next choice if they will release community edition.

@schplorg
Copy link

I'm getting the wrong directory issue too. dlls and such are expected to be in temp/bin, are actually in library/ScriptAssemblies instead.

...
I believe if you change your OutputPath in your .csproj files that should fix your problems, though!

@TheWanderingBen I tried this and it worked for a while, until those lines got switched back again in my .csproj files later on the same day :/
Is there a way to make the change permanently?

I got it working by dropping a symbolic link of Library/ScriptAssemblies into Temp/bin named Debug.
It's possible via cmd or with this neat shell extension:
http://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html
It's a dirty hack and I wish someone could point me to the real solution to this issue ❤️

@JamesYFC
Copy link

JamesYFC commented Oct 2, 2019

I'm getting the wrong directory issue too. dlls and such are expected to be in temp/bin, are actually in library/ScriptAssemblies instead.

...
I believe if you change your OutputPath in your .csproj files that should fix your problems, though!

@TheWanderingBen I tried this and it worked for a while, until those lines got switched back again in my .csproj files later on the same day :/
Is there a way to make the change permanently?

I got it working by dropping a symbolic link of Library/ScriptAssemblies into Temp/bin named Debug.
It's possible via cmd or with this neat shell extension:
http://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html
It's a dirty hack and I wish someone could point me to the real solution to this issue ❤️

Nice solution.

Did you get it to last any decent amount of time?
My symlink keeps getting deleted.

@RunninglVlan
Copy link

RunninglVlan commented Oct 10, 2019

@schplorg, for me symbolic links didn't help. They just removed "Unable to resolve assembly" warnings =(
I tried these commands: mklink /J "c:\<project>\Temp\bin\Debug" "C:\<project>\Library\ScriptAssemblies", mklink /D "c:\<project>\Temp\bin\Debug" "C:\<project>\Library\ScriptAssemblies"
What's interesting, I have the same project at home and at work, and definitions started not working only at work. =(
Yeah, and this feature works fine in Visual Studio.
Well, now that's really strange, even changing OutputPath in CSPROJ files doesn't help: <OutputPath>Library\ScriptAssemblies\</OutputPath>. Again it just removes warnings

Could someone help here?
BTW, it's interesting, that VS code knows about methods and documentation in these DLLs, but can't Go to Definition =D
image

@dvgco
Copy link

dvgco commented Oct 14, 2019

same issue for me, can not found the assembles in Temp/bin/Debug
so, the intellisense could not work.

@filipw
Copy link
Contributor

filipw commented Oct 14, 2019

Could someone help here?
BTW, it's interesting, that VS code knows about methods and documentation in these DLLs, but can't Go to Definition =D

This is a regression in extension 1.21.4.
See here for a workaround #3326 (comment)

you could also install 1.21.5 VSIX from https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.21.5 (it's not yet available on the marketplace)

@RunninglVlan
Copy link

RunninglVlan commented Oct 14, 2019

Thanks, @filipw, adding "omnisharp.path": "latest" to global (user) settings.json fixed the issue.

@filipw
Copy link
Contributor

filipw commented Oct 14, 2019

yep - I would just advise to remove it after 1.21.5 is shipped to the marketplace, since with "omnisharp.path": "latest" you opt into pulling the latest OmniSharp server build from master each time it's out there - which means it can be:

a) potentially unstable
b) slow
c) possibly incompatible with the C# extension

@RunninglVlan
Copy link

v1.21.5 is out in the Marketplace 🎉

@filipw
Copy link
Contributor

filipw commented Oct 16, 2019

yes correct it was published yesterday 👍

@JoeRobich
Copy link
Member

Please use the new Unity extension for VS Code. See details at https://code.visualstudio.com/docs/other/unity

@JoeRobich JoeRobich closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests