C# 7.0 in Visual Studio Enterprise 2015 [duplicate] - c#

This question already has answers here:
How to use C# 7 with Visual Studio 2015?
(2 answers)
Closed 5 years ago.
Can you switch on C# 7.0 features within Visual Studio 2015 (Enterprise) or do you need to upgrade to 2017?

Yes, you can replace the compiler shipped with Visual Studio for a C# 7-enabled version by installing the Nuget package Microsoft.Net.Compilers:
Referencing this package will cause the project to be built using the
specific version of the C# and Visual Basic compilers contained in the
package, as opposed to any system installed version.
There is no indication that I can see on the package page as to whether this is officially supported in Visual Studio 2015. My not-thorough tests so far indicate that it works but not painlessly - C# 7 code compiles, but is underlined with the red squiggly line which indicates a syntax error:
Note that you will also need to install the Nuget package System.ValueTuple to use the new C# 7 value tuples features.

You have to download/checkout and build the NET Compiler Platform ("Roslyn") from Github and then you can test the C# 7 Features with VS 2015!
More Info:
https://github.com/dotnet/roslyn/tree/master
If you like video tutorials, than watch this video:
https://joshvarty.wordpress.com/2016/02/10/lrn-quick-tip-how-to-test-out-c-7-features-with-roslyn/

Related

visual studio c# extensions missing

I've search the web and found questions from 3-9 years ago.
My problem is that I can't find anywhere the .NET standard or Windows Console Application or Windows Desktop Application or class Library for C#.
When I had Visual Studio 2015 - it was there by default.
Today I have Visual Studio 2017 and window 10 and I can't get my things together.
Are they canceled?
What is the other option?
When I look at my New project library -> Online -> Visual C#
There are many different applications but non of them seems to come from Microsoft.
Meanwhile I've got a .NET Core API Solution template but it has a lot of errors.
Please help
visual studio c# extensions missing
Just like Joe said, you should use Visual Studio installer to install the modules you need. Visual Studio 2017 use the a new way to install Visual Studio! In the newest version, MS have made it easier for you to select and install just the features you need. MS have also reduced the minimum footprint of Visual Studio so that it installs more quickly and with less system impact than ever before.
After the installer is installed, you can use it to customize your installation by selecting the feature sets—or workloads—that you want.
For the .NET core API project, you need install module .NET Core cross-platform development.
Check the document Install Visual Studio 2017 for some more details.
Hope this helps.

Enable C# 7 support in VSTS

It appears that VSTS does not support C# 7, as I'm getting a build error which would would indicate the C# 6 compiler is being used. How do I enable C# 7, or what am I doing wrong? I'm using Visual Studio 2017, targeting .NET 4.6.1.
I would rather not have to revert C# 7 changes I've added if possible. As can be seen in the screenshot of Visual Studio and the console in VSTS, there is a difference in the version of C# in use.
OK so it turns out that it was a simple fix, it was a counter-intuitive option in the UI. There's actually 2 places that configure the version of Visual Studio being used in VSTS. It needs to be set to Visual Studio 2017 or Latest and Hosted VS2017. Why there are 2 options is not very clear.

How to quickly yet reliably determine if Visual C++ 2013 Runtime is installed [duplicate]

This question already has answers here:
Detect if Visual C++ Redistributable for Visual Studio 2012 is installed
(21 answers)
Closed 6 years ago.
I'm trying to have my application determine whether or not Microsoft Visual C++ 2013 Redistributable has been installed on the user's system. I've looked through answers here, here, and here, but it looks like all of the answers fall into two major categories:
Check the registry: This is not an option because, if Visual Studio is installed or Visual C++ has been removed, you get false positives. This is the case for HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM\SOFTWARE\Microsoft\VisualStudio\12.0\VC, and HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VC.
Use WMI/check system tables using wmic product get or new ManagementObjectSearcher("SELECT * FROM Win32_Product"). This is reliable, but very slow (40+ sec), since it looks like it has to load all products installed on the system before it returns results.
When the redistributable installer is run, the installer is very quickly able to determine whether or not the component is already installed:
Or not installed:
What's the quickest way to do this that is still reliable? Ideally, I'd like to know: how does Microsoft do it so quickly? And can I do it that way?
As has now been explained in the answer to another question, there are more reliable registry values that can be used:
Microsoft Visual C++ 2013 Redistributable (x64)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Dependencies\{050d4fc8-5d48-4b8f-8972-47c82c46020f}
Configuration: x64
Version: 12.0.30501.0
Microsoft Visual C++ 2013 Redistributable (x86)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Dependencies\{f65db027-aff3-4070-886a-0d87064aabb1}
Configuration: x86
Version: 12.0.30501.0

Vector2 types in Win2D drawing method inconsistency

I'm making my first steps into the UAP world in Windows 10.
I'm trying to write a small app that displays graphics on an IoT / R-PI2-device using the Win2D library.
I have a drawing method that displays a single line:
private void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args)
{
var a = new System.Numerics.Vector2(10,10);
var b = new System.Numerics.Vector2(100,100);
args.DrawingSession.DrawLine(a,b,Colors.Yellow);
}
VS2015 community ed. IntelliSense is telling me that I'm supplying incompatible vector2-types with the arguments 'a' and 'b'. It's expecting Windows.Foundation.Numerics.Vector2 instead of System.Numerics.Vector2.
However, the program compiles and runs just fine on desktop as well as on the r-pi.
Parts of my app are based on this tutorial where the method clearly takes System.Numeric.Verctor2 arguments.
I read in another post, that there have been made changes to the API between Windows 8.1 and 10, as well as this GitHub issue.
I also imported the package mentioned in this post but it didn't change anything.
I don't know if this post has something to do with my problem but at least it mentions a problem with this two namespaces.
Why is IntelliSense highlighting this code as an error? Is there a bug in VS?
Am I doing anything wrong here?
The Project: https://github.com/chrisi/IoTCanvas
Some System / IDE Specs in case that is relevant:
Microsoft Visual Studio Community 2015 Version 14.0.23107.0 D14REL
Microsoft .NET Framework Version 4.6.00079
Installed Version: Community
Visual Basic 2015 00322-20000-00000-AA366
Visual C# 2015 00322-20000-00000-AA366
Visual C++ 2015 00322-20000-00000-AA366
Windows Phone SDK 8.0 - ENU 00322-20000-00000-AA366
Application Insights Tools for Visual Studio Package 1.0
JetBrains ReSharper Ultimate 2015.2 Build 103.0.20150818.200216
Microsoft Azure Mobile Services Tools 1.4
NuGet Package Manager 3.2.0
PreEmptive Analytics Visualizer 1.2
SQL Server Compact &SQLite Toolbox 4.3.0
Visual Studio Tools for Universal Windows Apps 14.0.23309.00 d14oob
System.Numerics.Vectors ships with Windows 10 and you do not need to install it separately.
The reason you are seeing references to Windows.Foundation.Numerics is because Windows.Foundation.Numerics is the name of the WinRT type. This is projected in .NET as System.Numerics.Vector2. Other languages may project it differently - in C++/CX it is Windows::Foundation::Numerics::float2, for example.
I strongly suspect that you are running into an issue with ReSharper - see https://github.com/Microsoft/Win2D/issues/145. The word from there is:
This one is fixed in R#10 and the fix will be available in one of the next EAP builds.

What parts of Roslyn can you use with VS 2013?

I want to build a C# app that uses the Roslyn NuGet packages. I have Visual Studio 2013. Things were going fine until I hit a ReflectionTypeLoadException looking for Microsoft.Build version 14, which I take it comes with VS 2015 CTP (see this question).
My question is, how far can you get with Roslyn without running into this issue? Do you just need to avoid using the MSBuildWorkspace class? What are the alternatives? Is it possible to download and use the Microsoft.Build assembly from 2015 while still using the 2013 IDE?
You need to download the MSBuild 14 tools from http://go.microsoft.com/?linkid=9863815

Categories