-
Notifications
You must be signed in to change notification settings - Fork 418
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
CSProj Loading Error #661
Comments
It appears that a netcoreapp1.0 version of OmniSharp is being used to open .csproj files. This isn't very functional today. It seems like you've downloaded OmniSharp and set the |
@DustinCampbell I actually forgot to mention that these are Core projects. In addition, yes, I have set the
I have built a custom copy of OmniSharp (following these directions) to avoid these errors. |
OK. That makes sense. Yeah, that error is going to be expected because that task requires a newer version of NuGet than what is bundled with OmniSharp. You might want to try the new release preview release I just put out https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.5-future-preview1. This includes at least initial support for MSBuild-based .NET Core projects. |
Well, that didn't work. I now get this exception on every project:
|
Whoa -- what OS are you using? OSX? |
Also, could you share one of the project files? |
Yeah, OSX. Here is a sample project file, as well. |
Hmmm... this works for me on OSX (Sierra) with a newly created .NET Core project using the latest CLI. The project isn't all that different: <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161104-2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> And I'm scratching my head a bit at why System.Configuration might throw. The MSBuild.dll.config file should look like the following and I don't see anything controversial there. Hmmm... <?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="msbuildToolsets" type="Microsoft.Build.Evaluation.ToolsetConfigurationSection, Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<runtime>
<DisableFXClosureWalk enabled="true" />
<generatePublisherEvidence enabled="false" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Conversion.Core" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Tasks.Core" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Utilities.Core" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>a
<assemblyIdentity name="Microsoft.Build.Engine" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Conversion.Core" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Activities.Build" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="15.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="XamlBuildTask" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="15.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<!-- To define one or more new toolsets, add an 'msbuildToolsets' element in this file. -->
<msbuildToolsets default="15.0">
<toolset toolsVersion="15.0">
<property name="MSBuildRootWorkaround704" value="$([MSBuild]::GetCurrentExecutableDirectory())" />
<!-- See https://github.com/Microsoft/msbuild/issues/704 -->
<property name="MSBuildToolsPath" value="." />
<property name="MSBuildToolsPath32" value="$(MSBuildToolsPath)" />
<property name="MSBuildToolsPath64" value="$(MSBuildToolsPath)\amd64" />
<property name="MSBuildRuntimeVersion" value="4.0.30319" />
<property name="TargetFrameworkRootPathSearchPathsOSX" value="/Library/Frameworks/Mono.framework/External/xbuild-frameworks/" />
<projectImportSearchPaths>
<searchPaths os="windows">
<property name="MSBuildExtensionsPath" value="$(MSBuildProgramFiles32)\MSBuild"/>
<property name="MSBuildExtensionsPath32" value="$(MSBuildProgramFiles32)\MSBuild"/>
<property name="MSBuildExtensionsPath64" value="$(MSBuildProgramFiles32)\MSBuild"/>
</searchPaths>
<searchPaths os="osx">
<property name="MSBuildExtensionsPath" value="/Library/Frameworks/Mono.framework/External/xbuild/"/>
<property name="MSBuildExtensionsPath32" value="/Library/Frameworks/Mono.framework/External/xbuild/"/>
<property name="MSBuildExtensionsPath64" value="/Library/Frameworks/Mono.framework/External/xbuild/"/>
</searchPaths>
</projectImportSearchPaths>
</toolset>
</msbuildToolsets>
</configuration> |
I can't find the |
It's MSBuild.dll.config in the MSBuild xplat builds. Yeah, I wouldn't expect that to affect anything. It shouldn't actually be looking there for anything anyway. |
Yeah, but where would I find that on my system? I want to verify that its contents match the example above. In addition, updating .NET CLI (to version 1.0.0-preview4-004071) doesn’t change anything. |
According to the exception you got, it should be in /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.5.0-future-preview1/bin/omnisharp/MSBuild.dll.config |
I got a repro |
BTW, my MSBuild.dll.config exactly matches yours. |
FYI, I'm getting closer on this. I'll let you know when I have a solution |
All right I've got a solution. I need to package it up again and provide you with instructions on how to try again once it's ready. |
OK. If you still have the preview installed, try the following:
cd /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.5.0-future-preview1/
rm -rf bin
rm install.lock Now, open Visual Studio Code and load your project. Fingers crossed! |
It works! Thank you so much! What exactly was the cause of this, by the way? |
Well, it nearly caused me to lose my remaining hair. The problem was that I did not include the machine.config file that is necessary to let the whole System.Configuration system work. The error was completely correct. |
And I am still having problems. I see “0 projects” in the VSCode status bar, and my intellisense is broken. (If I restart OmniSharp, it appears to be functional, but as soon as I start typing something it dies; the completion list simply says “Loading” and the “# references” lines in the editor vanish.) Furthermore, the OmniSharp log still displays the error about |
Note that when I place my cursor on a symbol and press F12, the OmniSharp log displays the following error:
This might have something to do with the broken intellisense. |
The "0 projects" issue is here: dotnet/vscode-csharp#835 |
Are you able to add me to your repo? If so, I'll take a look. I'd like to get this working for you. |
@DustinCampbell I’ve just sent you an invite to wjk/SunburstApps. |
thanks. I'll try it out and see if I can't get some fixes for you. |
@DustinCampbell I’ve removed your push access from wjk/SunburstApps, because you don’t need it anymore; I have opened the repository up to all contributors. Feel free to send in PRs, though! |
Sounds good. I've cloned the project and am working through issues. |
OK. I see why your getting that duplicate reference. Should be easy to fix. |
Note: the reason duplicate references are being added is because it's defined that way in your projects. Both powershell-unix/powershell.csproj and powershell-win/powershell.csproj reference System.Management.Automation.csproj and they both import Microsoft.PowerShell.SDK.targets which also adds the same reference again. OmniSharp should have been resilient against this case but it wasn't. |
That did it, all right. The duplicate-reference error is gone. |
I'll have a real fix coming for you soon. The duplicate reference shouldn't be something you have to manage. |
Nonetheless, thank you very, very much. I would never have found it on my own. Thank you! |
OK. I've updated the binaries again with a couple of fixes. You can refresh them by doing the following:
cd /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.5.0-future-preview1/
rm -rf bin
rm install.lock There are still several bugs lingering, but I'm going to resolve this one because I think we've gotten to the heart of it. |
When I try to load a fairly-simple tree of csproj files (private repo, though I can tell you it is a fairly simple port of PowerShell), the following exception is thrown (original, unedited transcript):
Several projects reference
System.Management.Automation.csproj
, both directly and indirectly. (I have to duplicate the references across many different projects because MSBuild<ProjectReference>
s are not transitive.) What's strange is that this error only shows up after the very last project is loaded,Microsoft.Management.Infrastructure.CimCmdlets
. If it was a problem about the DLL being added to the workspace too many times, it ought to occur at the time it is added the second time (by my observation, that would probably be during the loading ofMicrosoft.PowerShell.Security.csproj
).I would prepare a PR that prevents the adding of duplicate projects to the workspace, except that I cannot easily write any C# in VSCode right now because of omnisharp-vscode#836 et al. (As a developer, I am very dependent on the correct functioning of my IntelliSense. When it malfunctions, I have a very hard time writing any code at all.)
The text was updated successfully, but these errors were encountered: