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

System.ArgumentException: The parameter 'frameworkName' cannot be an empty string. #405

Open
pampersrocker opened this issue Feb 24, 2016 · 4 comments

Comments

@pampersrocker
Copy link

When I try to open a rather old VS 2008 Unity solution I do get the following error in VSCode and Atom:

[INFO] Starting OmniSharp at 'c:\test\test.sln'...
[INFO] Started OmniSharp from 'c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\jrieken.vscode-omnisharp\bin\omnisharp.cmd' with process id 12448...
[INFORMATION:OmniSharp.Startup] Omnisharp server running using stdio at location 'c:\test' on host 8816.
[INFORMATION:OmniSharp.Dnx.DnxPaths] Using runtime 'c:\test\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1'.
[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] Scanning 'c:\test' for DNX projects
[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] No project.json based projects found
[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] Loading project from 'c:\test\test.csproj'.
[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] Detecting projects in 'c:\test\test.sln'.
[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] Using toolset 2.0 for c:\test\test.csproj
[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Detecting CSX files in 'c:\test'.
[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Could not find any CSX files
[INFORMATION:OmniSharp.Startup] Solution has finished loading
[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] Using toolset 2.0 for c:\test\test.csproj
[WARNING:OmniSharp.MSBuild.MSBuildProjectSystem] Failed to process project file 'c:\test\test.csproj'.
System.ArgumentException: The parameter 'frameworkName' cannot be an empty string.
Parameter name: frameworkName
   at System.Runtime.Versioning.FrameworkName..ctor(String frameworkName)
   at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Create(MSBuildOptions options, ILogger logger, String solutionDirectory, String projectFilePath, ICollection`1 diagnostics)
   at OmniSharp.MSBuild.MSBuildProjectSystem.CreateProject(String projectFilePath)
c:\test\test.csproj(0,0)
System.ArgumentException: The parameter 'frameworkName' cannot be an empty string.
Parameter name: frameworkName
   at System.Runtime.Versioning.FrameworkName..ctor(String frameworkName)
   at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Create(MSBuildOptions options, ILogger logger, String solutionDirectory, String projectFilePath, ICollection`1 diagnostics)
   at OmniSharp.MSBuild.MSBuildProjectSystem.CreateProject(String projectFilePath)

Here's a Gist for the Minimal reproduction case (test.sln and test.csproj, fixed_test.csproj contains the workaround below): https://gist.github.com/pampersrocker/7d38b839eda1d06a4598

I've nailed down the bug to the following line:
https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.MSBuild/ProjectFile/ProjectFileInfo.cs#L91 (or the other ones from the other #ifs)

Whats the purpose of the TargetFrameworkMoniker ?
I can get it working when I add a TargetFrameworkMoniker into the csproj file, see https://gist.github.com/pampersrocker/7d38b839eda1d06a4598#file-fixed_test-csproj-L14

However this should not be needed as msbuild and VS 2008 can parse and build the projects without any problems.

When I create a new ConsoleApplication Project with VS 2015, everything works as expected.

@jjuel
Copy link

jjuel commented Mar 22, 2016

I am also getting the same issue with a VS2008 project that I am trying to edit with VS Code.

@filipw
Copy link
Member

filipw commented Mar 23, 2016

@pampersrocker @jjuel do you have a public project that can be used to reproduce this error? thanks

@willl
Copy link
Member

willl commented Mar 23, 2016

Looks like TargetFrameworkMoniker was added to VS 2010 to support multiple targeting.

https://blogs.msdn.microsoft.com/visualstudio/2010/05/19/visual-studio-managed-multi-targeting-part-1-concepts-target-framework-moniker-target-framework/

Our MSBuild project/solution support is rather preliminary and does not cater for many scenarios at present. Issue #202 details some of the other issues.

@filipw The gist @pampersrocker linked to seems to contain the relevant .csproj files that are producing the issue (the key line in his fixed version is the addition of the <TargetFrameworkMoniker>...</TargetFrameworkMoniker> line.

@pampersrocker
Copy link
Author

@filipw Look at my gist, there is a solution file and a csproj file.

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

4 participants