NRefactory capable of parsing .NET 4.6? - c#

I have been successfully using NRefactory and just started having problems parsing source code that uses some newer .NET features. One feature in particular that I have noticed is string interpolation. When NRefactory sees something like $"File: {myFile}" it has total failure parsing it.
Is there a new version of the code that will handle dot-NET 4.6 or is there a flag that I need to set? If not, is there another easy way to get parse trees from source code?
If I wanted to use Roslyn, is there a way to do this with VS 2015 or is VS 2017 or later required? Tried opening Roslyn SLN in VS 2015 and none of the projects loaded.

NRefactory does not support C# 6 or newer features, which would impact string interpolation. According to NRefactory,
There is currently no maintainer for NRefactory. If you need a C#
parser / compiler frontend, use Microsoft.CodeAnalysis (Roslyn)
instead.
The refactorings in NRefactory have been ported to Roslyn:
https://github.com/icsharpcode/RefactoringEssentials/
You can use Roslyn with Visual Studio 2015, as long as you have .NET 4.6 or higher installed, though 4.7.2 is the recommended version to use by Roslyn team. Lastly, you will need to the following:
Install Universal Windows App Development Tools -> Tools (1.1.1) and
Windows SDK, Windows 8.1 and Windows Phone 8.0/8.1 tools -> Tools and
Windows SDKs and Visual Studio Extensibility Tools

Related

Build server of an old ASP.NET 4 application fails building new C# 7, but it works in development

I recently start to work on a legacy ASP.NET codebase based on .NET framework 4.0. We managed to pass everything from Visual Studio 2012 to VS 2017, updated the build server with a new version of Jenkins and installing .NET framework 4.7.x.
Locally we can write C# code of the newest version (7.3) and the build works (VS doesn't use MSBuild if I remember right), but when we deploy on the build server the build fails because there MSBuild cannot recognize constructs newer than C# 4.0. To avoid mistakes I fixed the lang version to 4.0 (advanced build properties on projects), so if I write too new C# VS blocks me in dev, but we would like to start using new C#.
We also tried to fix C# 7.3 directly in the project (<LangVersion>7.3</LangVersion> in PropertyGroup inside csproj) and the but ToolsVersion property of Project element (csproj) to 14.0, but then building we MSBuild fails with the error:
CS1617: Invalid option ‘6’ for /langversion; must be ISO-1, ISO-2, 3,
4, 5 or Default
Here it's explained that what I want to do it is possible: https://www.dotnetcurry.com/dotnet/1427/build-apps-different-dotnet-framework-versions
No matter which .NET framework version we target in the project, the
C# language version in use will not change. That’s fine because the
vast majority of language features that were introduced in later
versions of the language don’t depend on the CLR or specific APIs.
They are only syntactic sugar and the bytecode generated by the
compiler will still work in .NET framework 2.0.
Anyone have an idea of what mistake are we doing?
The problem was that on the build server MSBuild wasn't properly installed and build scripts got an old one.
Installing Visual Studio 2017 Build tools and fixing the path on the script we solved.
After we had the problem "The “GetReferenceNearestTargetFrameworkTask” task was not found" we solved like explained here: The "GetReferenceNearestTargetFrameworkTask" task was not found
(the right answer depends on what strategy have you used to install VS Buld tools).

In Which .Net Framework Version C# 7.2 is Available

I tried installing .net framework 4.7.2, still the target framework is empty in the project properties. The program I'm trying to run uses readonly struct, which is part C# 7.2.
Could you please guide me .Net Framework version has C# 7.2?
Language features are independent of .Net version (Framework/Core/Standard).
You will need to use a compiler that understands the newer language features. Assuming you're using Visual Studio 2017, you should update to latest version.
By default C# projects in Visual Studio use the latest major release of the language (which would be 7.0 as of this writing). To change this, open up the project's properties, select the Build page, click Advanced..., and under General set Langauge Version to "C# 7.2".
Per phuzi's comment mentioning this question, you might need to update to the latest Visual Studio in order to see this option.

Running a .NET solution file in Linux without Admin rights

Note : I don't have root permission in my Linux box.
I need to compile a .NET (visual studio executable) solution file in my Linux machine.
I have just heard about a way that Microsoft is providing an extension to perform the same like mono, Yocto, etc.,
What are the possible ways that i can run the solution?
Can someone please tel me how do i do it?
the .NET framework has been made open source, but there is not official release yet for Linux. The development community for Linux would be the one most likely to make the tools.
Excerpt from Microsoft Site: .NET Core is Open Source
Today (Nov. 12, 2014) is a huge day for .NET! We’re happy to announce
that .NET Core will be open source, including the runtime as well as
the framework libraries.
This is a natural progression of our open source efforts, which
already covers the managed compilers (C#, VB, and F#) as well as
ASP.NET:
C# & Visual Basic ("Roslyn")
Visual F# Tools
ASP.NET 5
Entity Framework
This takes it to the next level by extending it to the .NET runtime
and the core framework.

Is there a way to use XCode to create ASP .NET files?

I have heard about C# for IOS development using Xamarin tool.I want to know that is there any support for .Net framework in Xcode.
No way to combine .Net framework with XCode IDE.
However you can write .Net languages with Mono framework for OSX.
Here is mono website you can learn.
http://www.mono-project.com/
Run a vm with xp and an older visual studio (for web development) version. I just had to bust out a project and I learned it and turned in my finished product in a week. Such a convenient easy-to-use IDE.

What software do i need to install to use WPF in VS2005

I have VS2005 and .net 3.5 installed on my machine I have heard of WPF and want to practice WPF solutions what other software should I install to write WPF program in VS2005 as it does not show any option for the same by default.
Also any link for some cool stuff for beginners on WPF will be very helpful.
Please help
You can get them from here: http://download.cnet.com/The-Visual-Studio-2005-extensions-for-NET-Framework-3-0-WCF-WPF-November-2006-CTP/3000-10250_4-10727672.html.
This was the last version Microsoft released before telling everyone to go with VS2008. If you can't do VS2008, this is an ok solution. We used it for a year and a half and have production UIs running based on it. The problems are that the designer is basically non-existent (so be ready to code XAML by hand), it can be a bit slow, and there's some bugs.
Re: 3.5, VS 2005 is incapable of handling 3.5 projects, linq, etc. If you really want, you can work outside of VS and just use msbuild 3.5. An interesting fact: .Net 3.5 replaces, among some libraries, the PresentationFramework assembly. The new version of this assembly includes additional methods and method signatures that are not included in .Net 3.0. This means that these new 3.5 methods will be accessible in VS2005.
Vinay,
i don't think 2005 can do WPF and it definitely cannot handle .Net 3.5. VS2005 is 2.0.
Start with downloading VS2008 Express. It's free and will have the tools you need to get started with WPF.
http://www.microsoft.com/express/download/
Microsoft had release a extension called "VS 2005 Extensions for .NET Framework 3.0 (WPF & WCF)" but it is not longer available and supported and Microsoft recommends that you upgrade to Visual Studio 2008.
I believe you'll need Visual Studio 2008 in order to do WPF (Windows Presentation Foundation) development, however, there is a way to do some Silverlight (which is a subset of the "full" WPF technology) using Visual Studio 2005. See here:
Silverlight with Visual Studio .NET 2005
You'll need the .NET Framework 3.0 at least, as well as the Silverlight Developer Runtime
Don't forget, though, that you can effectively get a "free" version of Visual Studio (via the Visual Web Developer Express 2008 version) which, I think, will allow "full" WPF development.
Building the Perfect Developer Workstation for WPF by Tim Sneath should answer your question

Categories