2,928 questions
57
votes
2
answers
12k
views
Is Roslyn cross platform?
I've been looking at Roslyn for quite some time now, and I'm curious and excited about it. One thing I noticed is that they mentioned that the compiler is re-written in managed code. This raises the ...
0
votes
1
answer
506
views
Locating a node in a CompilationUnitSyntax AND SemanticModel
When working with Roslyn, I will often have a node that is in the CompilationUnitSyntax but not the SemanticModel or vice-versa. (Or I can only pull the nodes out with operations of one or the other--...
1
vote
1
answer
104
views
Can I use Roslyn CTP in a shared hosting?
Im wondering if it is possible to use some cool features of Roslyn such as dynamic compilation in an ASP.NET application hosted in a shared hosting. Is that possible?
1
vote
1
answer
214
views
Rename project in Roslyn
How can I change name of (IProject) in Roslyn?
I found only the extension method UpdateAssemblyName(), but it do something else (of course).
16
votes
1
answer
4k
views
Get the SyntaxNode given the linenumber in a SyntaxTree
I want to get the SyntaxNode of a line given the location(lineNumber). The code below should be self-explanatory, but let me know of any questions.
static void Main()
{
string ...
0
votes
1
answer
187
views
workspace created in memory - can't access symbolinfo
I am creating a workspace in memory for unit testing purposes, but I cannot access the symbol info of a certain InvocationExpression (which is required for the CodeIssue I am testing). Here is a ...
0
votes
1
answer
162
views
is there a Roslyn API for a webbrowser?
What I am looking for is a an api that load a DOM and javascript and treat it in the manner of Roslyn. I can then use to analyze and convert different html into a compliant html 5 with jquery for ...
4
votes
1
answer
1k
views
Compilation errors when dealing with C# script using Roslyn
I am embedding a C# script engine into my application using Roslyn and so far, I can execute code with no issues. I can for example execute the following code:
using System;
var str = "Hello Roslyn";
...
3
votes
1
answer
449
views
AssemblyNameReference class does not exist, what is the replacement?
I'm checking the Roslyn API using 'Getting Started: Semantic Analysis' walkthrough.
There's a part in it which tries to add a reference to the compilation:
var compilation = Compilation.Create("...
5
votes
1
answer
2k
views
Assembly not found at runtime when running a Roslyn script
I am embedding a script engine based on Roslyn into my application and started facing some issues. When loading a reference into my engine, I do the following
var engine = new Roslyn.Scripting.CSharp....
10
votes
8
answers
4k
views
Roslyn vs Reflection for TypeScript code generator
I'm developing a TypeScript code generator that will use custom attributes on C# classes to generate TypeScript definitions and code files.
I'm considering two options for TypeScript code generation /...
28
votes
2
answers
19k
views
How do I compile a C# solution with Roslyn?
I have a piece of software that generates code for a C# project based on user actions. I would like to create a GUI to automatically compile the solution so I don't have to load up Visual Studio just ...
5
votes
3
answers
9k
views
Dynamic invoke of a method using named parameters
We're currently using .NET 3.5 and part of our application uses dynamic invocation (using MethodBase.Invoke)
I am wondering if it is possible to mix in Named Parameters (in .NET 4) with dynamic ...
6
votes
2
answers
3k
views
Roslyn: workspace loads in console application but not in msbuild task
I have a custom msbuild task with this command:
var workspace = Workspace.LoadStandAloneProject(csprojPath);
When I run it, it throws the following error:
System.InvalidCastException was unhandled ...
8
votes
3
answers
3k
views
Built-in C#/VB.Net editor with intellisense - Roslyn, VSTA, or something else?
I need to provide scripting capabilities within my application, allowing customers to extend its functionality using our object model. I was hoping to offer some kind of integrated C#/VB.Net editor ...
4
votes
1
answer
450
views
How can I restrict access to members in an assembly from Roslyn script engine?
I am experimenting with the Roslyn script engine. Using the following code, I set up my script engine.
var csharpEngine = new ScriptEngine();
csharpEngine.AddReference("System");
csharpEngine....
1
vote
1
answer
153
views
How to determine which SemanticModel instance resolves an ExpressionSyntax
To find the target of an ExpressionSyntax instance I call mySemanticModel.GetSymbolInfo(myExpressionSyntax).
I have several SemanticModel instances that each relate to a code file's syntax tree.
I ...
3
votes
1
answer
204
views
Dialog window in Roslyn
I would like to implement a Rename-refactoring with Roslyn in Visual Studio. To do this, I want the user to enter the desired name that would be given to selected variable. How can I prompt the user ...
8
votes
2
answers
4k
views
Roslyn Add a document to a project
I'm running roslyn ctp2
I am attempting to add a new html file to a project
IWorkspace workspace = Workspace.LoadSolution("MySolution.sln");
var originalSolution = workspace.CurrentSolution;
...
5
votes
2
answers
488
views
Roslyn - Can't find SyntaxNode.ReplaceNode()
Following this tutorial http://msdn.microsoft.com/en-us/vstudio/hh543922.aspx , I'm trying to use the ReplaceNode method that should be in the SyntaxNode class.
The thing is, I have this error: "...
9
votes
1
answer
3k
views
modify syntax tree, then get updated semantic model
I'm trying to modify syntax tree and then get semantic model updated. Here is what I have so far:
var tree = Roslyn.Compilers.CSharp.SyntaxTree.ParseCompilationUnit(code);
var compilation = Roslyn....
1
vote
1
answer
672
views
how to turn ExpressionStatementSyntax into ParenthesizedExpressionSyntax (put parentheses around expression)
Suppose I have "".GetType() which is ExpressionStatementSyntax (or maybe InvocationExpressionSyntax) in the syntax tree and I want to turn it into ("".GetType()), that is I want to turn my ...
2
votes
1
answer
2k
views
Get all types with roslyn
I want to use Roslyn to get all types used in a piece of code. I started with the following SyntaxWalker:
public class DependenciesCollector : SyntaxWalker
{
public override void ...
0
votes
1
answer
261
views
Error when trying to open C# Interactive window
I just installed the Roslyn CTP, but when I try to open the C# Interactive Window I got a popup error message:
No valid exports were found that match the constraint '((exportDefinition.ContractName =...
0
votes
1
answer
349
views
Detect IWorkspace changes by VS from outside VS host environment?
Using Roslyn's Workspaces, is there any way to acquire a hook into the active IWorkspace provided by Visual Studio?
I want to be able to open ExampleProject in Visual Studio, then in my own ...