Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Roslyn with .net 4.5.2

Has anyone successfully installed Roslyn nuget packages on projects with target framework 4.5.2?

I am trying to install Microsoft.CodeAnalysis.CSharp.Scripting package, but havent seen success yet. It fails due to various dependent assemblies.

Please let me know if you have installed any Roslyn build on framework > 4.5

like image 292
Purbasha Avatar asked Feb 18 '16 04:02

Purbasha


3 Answers

I took a look into Cake build system project, they use C# scripting and whole thing runs on .Net 4.5. The secret behind this is:

<package id="Microsoft.CodeAnalysis.Scripting.CSharp" version="1.0.0-rc2" targetFramework="net45" />

I guess rc2 was compiled against .Net 4.5 so it should work.

Example packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.CodeAnalysis.Analyzers" version="1.0.0-rc2" targetFramework="net452" />
  <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net452" />
  <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc2" targetFramework="net452" />
  <package id="Microsoft.CodeAnalysis.Scripting.Common" version="1.0.0-rc2" targetFramework="net452" />
  <package id="Microsoft.CodeAnalysis.Scripting.CSharp" version="1.0.0-rc2" targetFramework="net452" />
  <package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net452" />
  <package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net452" />
</packages>

Or using the Package Management Console:

Install-Package Microsoft.CodeAnalysis.CSharp -Version 1.0.0-rc2 -IncludePrerelease
Install-Package Microsoft.CodeAnalysis.Scripting.CSharp -Version 1.0.0-rc2 -IncludePrerelease
like image 104
Arkadiusz Wojcik Avatar answered Nov 15 '22 03:11

Arkadiusz Wojcik


Scripting requires fixes made as part of .Net 4.6.

like image 3
Kevin Pilch Avatar answered Nov 15 '22 03:11

Kevin Pilch


Microsoft.CodeAnalysis.CSharp.Scripting latest version 1.2.1 (and previous versions) does not support library of 4.5. It requires at least .net 4.6.

like image 3
rovsen Avatar answered Nov 15 '22 02:11

rovsen