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

Why does "Microsoft.CodeAnalysis.Scripting.Common" need a fixed version from "Microsoft.CodeAnalysis.Common"? #42935

Closed
StefH opened this issue Mar 31, 2020 · 7 comments
Labels
Area-Interactive Resolution-By Design The behavior reported in the issue matches the current design

Comments

@StefH
Copy link

StefH commented Mar 31, 2020

When I look at the NuGet dependencies for:
Microsoft.CodeAnalysis.Scripting.Common - 3.4.0, I see this:
image

Why is an exact version 3.4.0 needed ? And not just => 3.4.0 ?

See also

@sharwell
Copy link
Member

The scripting libraries use internal APIs from other layers. There is no guarantee that these will work except when the versions are an exact match. For example:

<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Scripting" />

In other words, this dependency is a true version-locked dependency.

@sharwell sharwell added Area-Interactive Resolution-By Design The behavior reported in the issue matches the current design labels Mar 31, 2020
@StefH
Copy link
Author

StefH commented Mar 31, 2020

This design makes using/referencing the Microsoft.CodeAnalysis.CSharp.Scripting in another project (like https://www.nuget.org/packages/CS-Script.Core/) impossible because when you use another library like (Microsoft.VisualStudio.Web.CodeGeneration.Design) you cannot install this:

Microsoft.VisualStudio.Web.CodeGeneration.Design 3.1.1: Microsoft.CodeAnalysis.Common (= 3.3.1)
CS-Script.Core 1.3.1: Microsoft.CodeAnalysis.Common (= 3.4.0)

@jmarolf
Copy link
Contributor

jmarolf commented Mar 31, 2020

You should be able to pick a version that matches the dependency for Microsoft.VisualStudio.Web.CodeGeneration.Design. Is that not possible?

@sharwell
Copy link
Member

Microsoft.VisualStudio.Web.CodeGeneration.Design
CS-Script.Core

Neither of these packages has access to the internal APIs. I'm not sure why they would use fixed versions.

@StefH
Copy link
Author

StefH commented Mar 31, 2020

CS-Script.Core uses Microsoft.CodeAnalysis.Scripting.Common 3.4.0 which needs a fixed version Microsoft.CodeAnalysis.Common (= 3.4.0)

Microsoft.VisualStudio.Web.CodeGeneration.Design uses this path:
Microsoft.VisualStudio.Web.CodeGeneration 3.1.1 -> Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore 3.1.1 -> Microsoft.VisualStudio.Web.CodeGeneration.Core 3.1.1 -> Microsoft.VisualStudio.Web.CodeGeneration.Templating 3.1.1 -> Microsoft.VisualStudio.Web.CodeGeneration.Utils 3.1.1 -> Microsoft.CodeAnalysis.CSharp.Workspaces 3.3.1 -> Microsoft.CodeAnalysis.Common (= 3.3.1).
Which ends in using a fixed version 3.3.1

So it's impossible to install these 2 libraries in 1 single project.
Normally when using => 3.3.1, this works out fine.

@sharwell
Copy link
Member

Have you tried explicitly installing Microsoft.CodeAnalysis.CSharp.Workspaces version 3.4.0 in the same project?

@StefH
Copy link
Author

StefH commented Mar 31, 2020

This indeed solves the issue (because it's allowed to install a higher version for Microsoft.CodeAnalysis.CSharp.Workspaces)

image

@StefH StefH closed this as completed Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Interactive Resolution-By Design The behavior reported in the issue matches the current design
Projects
None yet
Development

No branches or pull requests

3 participants