What impact installing Roslyn will have on my VS Installation - c#

I wrote a few VS Extensions and Roslyn seems to be an interesting tool in such endeavors. I would be really curious to try it.
But
Is there a safe way to install it? Can I install it in an isolated hive? How cleanly does it uninstall?
Correct me if I am wrong but the Roslyn compiler replaces the 'Standard' C# compiler. If it breaks the result will be quiet unpleasant

I think this thread should have answers to your questions. When you install the CTP it replaces the C# and VB language services under the 'Roslyn' rootsuffix inside Visual Studio. The 'Standard' C# and VB compilers (including the command line compilers vbc.exe and csc.exe) are not replaced and your regular code editing experience inside VS is left unchanged.
In other words, the intention is that the CTP shouldn't impact your existing setup - but to be sure you could follow Hank's suggestion and install it on a Virtual PC.
This thread also has some discussion around this.
Disclaimer: I work for Microsoft on the Roslyn team.

Yes, it's safe to install. I installed on VS 2012 and it was working fine, but it causes problem when used with Resharper. You can even uninstall it with Tools->Extensions and Updates.

Related

How to use roslyn c# compiler with visual studio 2015?

I've a bit of confusion about roslyn.
What I have done:
I've installed vs 2015 community edition and download in extensibilty > download compiler platform sdk.
So I created a simple console application: hello world example.
Well now I'm expect to choise the c# compiler between the vs2015 default one and roslyn..., but I've not found such option.
So my first question is: how to select version of c# compiler?
Second I've downloaded master-roslyn and I build, then I found csc.exe, well the odd things is that if I lauch the exe
I get c# compiler version 42.42.42.42. ???? Right?
Then I've follow some tutorials, but all purpose me:
to load a source from text file or string vars and analyze or change syntax tree, then compile to var.
Well at this point I'm confused... So:
What is roslyn exactly? A meta compiler? This mean that I can change my code at runtime just like Reflection?
Second: how can compile with vs2015 with default csc or choose roslyn?
third: If I build a custom version of roslyn How can I compile my source using Vs2015 ?
Which know if csc.exe is roslyn? No help or command line print the codename.
Thanks
So it looks like you've got a few questions:
What is Roslyn?
Roslyn is the new default compiler inside of Visual Studio 2015. If you're building and running applications within Visual Studio 2015, they're being compiled with the Roslyn compiler. You'll get to take advantage of all the new C# 6 features that are available only within the new compiler.
If you're using VS2015, Roslyn has replaced the old compiler entirely and as far as I know you can't use the old compiler within VS 2015.
Roslyn is also a platform that allows you to build programs that can modify, interpret and understand other programs. It's not really meant to let you write code that modifies itself (although that's probably possible to a degree).
The common use cases for Roslyn are:
Building Code Analyzers that provide errors and warnings within Visual Studio.
Building extensions for Visual Studio that understand source code.
Building other tools that understand or run source code. Example: ScriptCS - Scripting with C# code.
In order to use Roslyn for these purposes, you pull down the Microsoft.CodeAnalysis packages from NuGet. You can use these packages to parse code, analyze syntax trees, analyze symbols or compile code and emit IL.
If you're interested in learning more about Roslyn, I've started a series called Learn Roslyn Now that you might be interested in.
Can I replace the compiler?
Yes you can, but I'm not convinced this is a great idea outside of testing changes you want to contribute back to Roslyn. You can pull down Roslyn from GitHub and follow these instructions to build and run Roslyn from within Visual Studio.
If you follow those instructions, you'll be able to run the Roslyn project with F5. It will start a new instance of Visual Studio that's using your customized compiler. This is how people outside of Microsoft will contribute features to the compiler from now on. (Previously you couldn't deploy your custom compiler to Visual Studio but they fixed that in Visual Studio Update 1).
Roslyn is two things:
An API that lets you see "compiler things" like syntax trees and symbols.
A new csc.exe that is implemented atop #1.
If you want to make changes to the compiler and use that to build, take a look at these instructions if you haven't already. There's a few different ways you can make your own version of csc.exe and then use that to build something. But there's no "choice" dialog like you're looking for.
Roslyn is the default compiler of Visual Studio 2015. So, if you install VS2015 you´re already using Roslyn.
Roslyn is a codename for .NET Compiler Platform, and it provides open-source C# and Visual Basic compilers. The project is available on github.

Is it easy/safe to upgrade from VisualStudio 2005 to 2010 (for WinForms projects)?

my team have built many tools for our project using win forms and Visual Studio 2005. We are thinking about upgrading to VS 2010.
Just wanted a heads up on any compatibility issues and also any benefits of upgrading.
Does upgrading involve lot of time and effort or does Visual Studio take care of it?
Your answers will be help us take a decision. Thanks.
Pros:
.NET improvements (provided that you upgrade the framework version)
Availability of newer 3rd-party libraries and tools for newer .NET (same as above)
IDE improvements
Neutral:
WinForms hasn't changed much between .NET 2.0 and 4.0.
Cons:
VS 2010 is a vastly heavier program, requiring much more CPU and RAM and faster disks to operate smoothly.
You decide.
as far as I know are there no downside's
I only know that all your changes in the visual side are gonna be placed in [name of form or usercontrol].Designer.[cs/vb]
I am a user of VS2010 and Im really happy with it so,
but why not wait on VS2012?
Kind Regards,
Corné
Yes it is possible and easy but lot of depends on the features you have used in your app. It should not be depreciated in VS 2010. Take a back up of your project and try to convert it, conversion wizard will list out all the warnings and error it faced while converting your app.Then you can take a decision on the basis of it whether to upgrade your app or not?
You'll want to check the breaking changes in C# 2008 and C# 2010, then the migration issues in .NET 3.5 and .NET 4.0, but only if you choose to upgrade the Framework target. Simply upgrading it to be readable and compilable by VS 2010 should not introduce any major issues. But, check if your project involve external component that's upgraded/removed in VS 2010, such as Reporting components, SQL connection, etc. In my experience, third party component suffer the most.
As for the benefit, lots. Check the Visual Studio Gallery for some extremely useful extensions (my favourite is the free Coderush Xpress), experience the joy of C# REPL with Roslyn, or heck, simply the Intellisense improvements makes me dread every time I'm forced to use 2008 or other IDEs.
Open the VS2005 solution in VS2010 and a wizard will open and upgrade your solution.
Just take a backup on the existing solution and give it a try. VS 2010 is very nice!
Everyone has different expectations and differences in their list of pros and cons. As such, the best way to decide if it's right for you is to go ahead and try it. As already mentioned, it will upgrade your project files (including making a backup for you first) when you try to open them.
You can download the trial from the Microsoft website and install it alongside your existing VS2005 install. If you're worried about installing alongside, install it into a virtual machine or download the ready made virtual machine images from http://blogs.msdn.com/b/briankel/archive/2010/06/25/now-available-visual-studio-2010-rtm-virtual-machine-with-sample-data-and-hands-on-labs.aspx

Will VS 2010 allow me to use the new async and await keywords in C#?

When the new async and await features go live, will I be able to use them in Visual Studio 2010, or will I need to have Visual Studio?
What I'm asking is this: will Microsoft maintain language feature parity between VS 2010 and VS 11? The CTP is a preview, solid or not, and our customers don't want us using technology that is perceived to be incomplete or untested - so despite the licensing I can't use it.
My employer is not purchasing VS 11, so I need to know whether or not I'm wasting my time writing code with async and await.
Right now the Async CTP allows for you to use the new awaits and async syntax in Visual Studio 2010. It's common for the language teams to provide CTPs for the current version of Visual Studio when demonstrating new features. It's a great way to let developers experiment and give feedback to the language team.
However for the final release the new language features are typically only made available for the next version of Visual Studio (Dev11 in this case). They aren't back ported to the previous version of Visual Studio.
This pattern of CTP in current release and final in next has happened before with LINQ. It's almost certain to repeat with awaits
Just install the Async CTP, reference the dll in your project and you can use async and await. Or install VS11 and use it directly with .Net 4.5. If you want to use it in production anytime soon i'd go with the first option.
EDIT: For anyone still looking this up. If at this point you still have an .Net 4.0 application and want to use all the async features of .Net 4.5, there has been a Nuget Package called Microsoft Async. You only need to have at least Visual Studio 2012. With that package you won't have to fiddle around installing the Async CTP when you already have VS2012. (Also, installing the Async CTP side-by-side with VS2012 doesn't really work from what i've tried)
You can use them in 2010. I ran the developer preview in 2010 with no problems. Resharper however didn't recognize the keywords but they have (or will) be remedying that in later releases.
Due to the scope of changes it would mean, it's extremely unlikely to make it back to VS2010 as an official release.
As others have commented, though, you can use the CTP fine. If your concern is around it being officially supported, though, it's almost certainly going to mean using VS11 (the Beta has a go-live license, FWIW)
As i understand it, the new functionality will be part of C# 5.0.
As per the past releases to the framework and programming languages, they were available with the new studio release that usually came together with this.
However, in the past we have been able to use newer C# features by referencing the library that holds them, therefore this may become possible by referencing something required.

System Requirements for running CodeDom

I know that C# applications will require the .Net framework to execute on any given machine. However, I am curious, in order for CodeDom to work properly must Visual Studio also be installed on the computer the application is being run? I only ask because doesn't CodeDom use a file that is part of the VS installation when producing files?
If you know of any other system requirements I would appreciate hearing about them.
No, using CodeDOM doesn't require Visual Studio to be installed. It works fine without it.
And compiling code by yourself doesn't require VS either. All you need is the C# compiler – csc.exe. And that is part of the .Net installation. When compiling source code to an assembly, CodeDOM actually invokes csc.exe.

Can I edit a Visual Studio 2008 project in 2010 while keeping it a 2008 only project?

So on my computer I only have Visual Studio 2010 Express. I need to edit a Visual Studio 2008 project, however it needs to be kept in C# 3.5.
Before I open it in 2010 and accidentally upgrade it, will it be kept in 2008 or C#3.5 format?
I realize I wont be able to use .Net 2010 features, so thats no problem. I just want to make sure if I save my 2008 project using 2010 I will still be able to open it in 2008 and it will work fine.
The target framework of the project is independent of the solution format. That is, you can convert your project to Visual Studio 2010 and still target the 3.5 Framework. But, once it's converted to 2010, you will not be able to open it in 2008.
You cannot open a project in VS2010 without it being upgraded. The Framework version can be controlled independently, so you can still target 3.5.
The changes to the project/solution files to use 2010 (assuming you don't use any newer features) are fairly minimal, so there may be mileage in just not committing the project/solution files (you can probably achieve this by dropping an ignore file for your source control provider in your local folder, including adding the ignore file to itself, so that doesn't get committed).
If you're mostly editing code (and not often changing the projects in the solution, or files in the projects) you could also have two copies of the files, one for each version, until you can commit to 2010 everywhere (and with Express for free, you might be able to do this quickly?).
No, VS2010 will convert the VS2008 project file. After it is converted, VS2008 can no longer open it. There are ways to hack around this, the simple solution is to just use VS2010 consistently. Next best thing is to only check-in the source code changes. Next best thing is to give the 2010 project a different name and maintain them both, at least for now.
You'd be hard pressed to accidentally upgrade it. When you open a VS2008 project in VS2010, it automatically starts the upgrade wizard, and you have to decide whether to let it do the upgrade, including making a decision whether to let it take a backup before it does the upgrade.
You can't open a VS2008 project in VS2010 and work on it without upgrading it to VS2010 format first. And once you've allowed VS2010 to upgrade it, you won't be able to open it in VS2008 any more.
Careful though - don't confuse the version of the framework you want to target, with the version of VS that you're using.
You can target framework 3.5 with VS2010.
There are hacks that let you open VS2010-upgraded projects in VS2008, but it's not a great plan to go down that road (guess how I know).
When you are going to convert it with compatible to 2010 it will ask for the backup...
so... later you can retrieve your file back ...
I might be wrong but I'm almost sure that project files don't differ between 2008 and 2010 or at least they are compatible. Solution files are a different matter and old solutions do indeed need to be converted. Usually you have few solutions for 2008 and 2010 versions of VS, but they contain the same projects, so the projects don't need to be converted.
I was on a seminar where they took this (short of classic?) accident as a sample for versioning. They get a 2008 project from git and start it in vs 2010.
Did the upgrade process and then "ops, i can't revert the upgrade". They commited the vs2010 converted files to a branch in GIT. When they "came home again", merged the changes in project together with 2008 solution files.
This may not come in touch to you, but the sense is:
All files is intact but the solution/project files. So just keep them safe and you can continue use the 2008 version after done your editing in 2010.
Though, without any kind of manual handling of solution/project files - answer (on the question in your subject) is No!
In short, no. Once it's upgraded, it stays that way. There is no official way to downgrade it either. The main driver behind this fact is because of the compiler. Even if you stay in .NET Framework 3.5, you can still use C# 4.0 features (like optional / named parameters) since 2010 will always use the 4.0 compiler.
Imagine a situation where it stayed in a 2008 format but you used a C# 4.0 language feature. Since VS 2008 always uses the C# 3.0 compiler, whenever you open it in 2008, it will no longer compile. This is a good reason to avoid work-arounds that have been posted for downgrading - you get mixed compiler features that can break things pretty easily.

Categories

Resources