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

Failed to build OmniSharp.Abstractions #418

Closed
guardrex opened this issue Mar 7, 2016 · 11 comments
Closed

Failed to build OmniSharp.Abstractions #418

guardrex opened this issue Mar 7, 2016 · 11 comments

Comments

@guardrex
Copy link

guardrex commented Mar 7, 2016

@troydai Following our comments at https://github.com/dotnet/cli/issues/1618#issuecomment-191970379

I don't have the DNX_UNSTABLE_FEED set on my Win10 laptop. It fully restores, but I ran into this (twice) attempting to build ...

capture

capture1

[EDIT] Should I attempt to strip the dnx451 framework out of the project.json files and attempt a build on dnxcore50 or netstandardapp1.5?

@troydai
Copy link
Contributor

troydai commented Mar 7, 2016

Thanks for reporting this, @guardrex . You don't need to remove the framework. Everything is supposed to work right away.

I won't be able to repo this failure. But there are a few things you can begin with to solve this issue.

  1. I suspect some cached old packages is misleading the restoring. Can you try clean the cached packages? Remove following folders: %userprofile%\.nuget\package and %localappdata%\NuGet\v3-cache.
  2. If it still repos. Please enter the folder and OmniSharp.Abstractions and execute dotnet build the full build output should give us more clues.

@guardrex
Copy link
Author

guardrex commented Mar 7, 2016

@troydai It was a fresh install of dotnet cli, VS Code, and DNVM/DNX on the laptop. Although, idk if the NuGet cache folder may have had packages prior to these installs.

I ran dotnet build from the folder, and it came out ...

capture

@guardrex
Copy link
Author

guardrex commented Mar 7, 2016

@troydai It seems to like dnxcore50 (and I forgot for a sec about the -f switch, but know now) ...

capture1

I'm going to proceed with an attempt to build the whole thing for dnxcore50 and report back.

@guardrex
Copy link
Author

guardrex commented Mar 7, 2016

@troydai Doesn't look like it worked out. A few warnings thrown for dep conflicts. There is an error in the OmniSharp Log in VS Code ...

capture
capture1
capture2

[EDIT] In spite of that error, it seems like OmniSharp is working. I get the flame and IntelliSense ...

capture

@hal-ler
Copy link
Contributor

hal-ler commented Mar 7, 2016

For me the original error popped up from a lack of .NET 4.5.1 Reference Assemblies on my system. One recommended solution was to install VS. I found an alternate hack, by installing: https://www.microsoft.com/en-us/download/details.aspx?id=49978 and creating a copy for 4.5.1 of the folder "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1".

@guardrex
Copy link
Author

guardrex commented Mar 7, 2016

@hal-ler Excellent point. This laptop does not have those ref assemblies and that probably explains it.

Is the OmniSharp startup error "The project system 'DotNetProjectSystem' threw exception during initialization." of any concern?

When compiling for v4.5.1 without the ref assemblies, is the prior exception behavior "by-design" for a missing .NET 4.5.x framework?

@hal-ler
Copy link
Contributor

hal-ler commented Mar 7, 2016

I have only started playing around with the code recently, so take whatever I say with a grain of salt.

I was able to replicate your exception by convincing VS Code that a particular folder is a .NET Core project without a project.json residing within it. Omnisharp then tried to associate the folder with a workspace, but failed.

In my case the flame is on, but there is no IntelliSense, only editor suggestion for text (try to type "Console." and all the options should pop up). I suggest looking at your project.json file to see what is causing the issue.

@guardrex
Copy link
Author

guardrex commented Mar 7, 2016

You are correct: The methods are not appearing with Intellisense. I thought it was working b/c when I opened a couple of code files, I wasn't getting bad ref indicators (squiggles) under method names. It's not performing look-ups, so it is not working.

@troydai
Copy link
Contributor

troydai commented Mar 7, 2016

@guardrex

I actually don't have a Windows environment without .NET installed. So I didn't test this Environment, my bad. In that case, yes the build failure is due to missing .NET 4.5.1 references. The solution @hal-ler gave will fix this.

On Mac and Linux this problem is solved by setting an environment variable: #412.

For the other issue, The project system 'DotNetProjectSystem' threw exception during initialization. means the project system can't be initialized correctly. Again this is due to the missing of .NET 4.5.1 reference assemblies on you machine. If your project target dnx451 or net451 framework, the DotNetProjectSystem will try to resolve the framework references.

On this note, I think a better error message as well as a choice to ignore entire target framework is a better user experience: dotnet/vscode-csharp#39

@guardrex
Copy link
Author

guardrex commented Mar 7, 2016

@troydai

I see. I don't explicitly want to ref net451 (all of my apps are of the Core CLR variety), but I'm still having to use imports for unsupported packages ...

"netstandardapp1.5": {
    "imports": [ "dnxcore50", "portable-net45+win8" ]
}

Thanks @troydai and @hal-ler. I'm not sure I'll go to the trouble of installing .NET 4.5.1 or not. I might just rough it out for a few more weeks in hopes that VS Code gets baked-in goodness soon.

@guardrex guardrex closed this as completed Mar 7, 2016
@guardrex
Copy link
Author

guardrex commented Mar 8, 2016

@troydai @hal-ler ... yes ... @hal-ler ... thank you much ... your workaround worked for me. I installed the .NET Framework from https://www.microsoft.com/en-us/download/details.aspx?id=49978

I copied the folder ...

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1`

to a folder called ...

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1`

The ./build.ps1 script ran to completion ...

omnisharp-published-ok

My apps targeting netstandardapp1.5 (with the usual imports) are getting intellisence with the VS Code workspace setting ...

"csharp.omnisharp": "C:\\omnisharp-roslyn-dev\\artifacts\\publish\\OmniSharp\\dnxcore50\\
OmniSharp.exe"

I'm good. Thanks again to both of you for your help. I plan to stop pulling down DNX runtimes now, so let me know if that's going to be a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants