Enable C# 7 support in VSTS - c#

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.

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.

C# 7.0 in Visual Studio Enterprise 2015 [duplicate]

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/

Visual Studio - cannot run any projects: application was unable to start correctly (0xc0000142)

Windows 10 x64
Visual Studio 2012 x32
.NET Framework 3.5 and 4.6
I cannot run/debug/F5 any projects in Visual Studio. I have tried nopCommerce, BlogEngineDotNet, File->New Website, etc. First I was getting an error about .NET 4.5 and .NET 4.0 not being registered, but I installed the fix from Microsoft (https://support.microsoft.com/en-us/kb/3002339) which resolved that issue.
Now, everytime I try to F5 I get the error below.
I've searched until I was ready to beat my head against the desk. I found a lot of posts from a few years ago saying to use dependency walker to see if any pre reqs fail, but dependency walker says its only good up to Windows 8.
I ran into this issue after I switched the "Default terminal application" to Windows Terminal. I had to restart Visual Studio and then it worked again but using Windows Terminal caused other issues so I had to revert and restart VS again.
As #Trout.Z mentioned, you may also want to enable the Automatically close the console when debugging stops option in Visual Studio. You can find it in the options under Debugging > General.
uninstall Visual Studio 2012 x32 and install new Visual Studio 2012 x64 because your os is 64 bit
above code helps you to make it working.

ReSharper Unit Test not run in bin directory

Preamble
I know, that this question seems to have anwsers here:
Resharper runs UnitTest from different location
Resharper Unit Test Runner Can't Find Content Files
I have nearly the same problem like ReSharper 10 test runner failing to find AppSettings referenced from external file.
But these answer stated, that the problem should be gone with ReSharper 10.0.2
Question
I included a custom.xml files with custom settings, and I need to read them from my unit test. But my file is not found.
I looked, where the process runs, and included this line
var curdir = Directory.GetCurrentDirectory();
So I found out, that curdir is C:\\Users\\MYUSER\\AppData\\Local\\JetBrains\\Installations\\ReSharperPlatformVs11_000
Now it is obvious that my file cannot be found. After googling it, it found the above mentioned questions. But none of these solutions works for me.
These are my settings:
Visual Studio Configuration
Microsoft Visual Studio Ultimate 2012
Version 11.0.61219.00 Update 5
Microsoft .NET Framework
Version 4.6.01038
Installierte Version: Ultimate
Architecture and Modeling Tools 04940-004-0038003-02857
Team Explorer für Visual Studio 2012 04940-004-0038003-02857
Microsoft Team Explorer für Visual Studio 2012
Visual Basic 2012 04940-004-0038003-02857
Microsoft Visual Basic 2012
Visual C# 2012 04940-004-0038003-02857
Microsoft Visual C# 2012
Visual C++ 2012 04940-004-0038003-02857
Microsoft Visual C++ 2012
Visual F# 2012 04940-004-0038003-02857
Microsoft Visual F# 2012
Windows Phone SDK 8.0 - DEU 04940-004-0038003-02857
Windows Phone SDK 8.0 - DEU
ASP.NET and Web Tools 2012.3.41009
GenerateUnitTest 1.0
Git Source Control Provider 1.0.0.0
JetBrains ReSharper Ultimate 10.0.2 Build 104.0.20151218.120627
Microsoft Advertising SDK for Windows Phone 6.2.923.0
Microsoft Advertising SDK for Windows Phone Build 6.2.923.0
Microsoft XNA Game Studio 4.0
Microsoft XNA Game Studio 4.0
NuGet-Paket-Manager 2.8.60318.667
PreEmptive Analytics Visualizer 1.0
SQL Server Data Tools 11.1.20627.00
Microsoft SQL Server Data Tools
Git Extensions
You don't list any version of NUnit installed, but you tagged this 'nunit' so I'm going to make an assumption you are using it! Further, I'm assuming NUnit >= 3.0... ignore this if otherwise. :-)
NUnit 3.0 stopped changing current directory. It's a bad idea for us to do that anyway and it's a really bad idea with 3.0, when multiple assemblies in differing directories may be running at the same time.
So, assuming still it's an NUnit problem, instead of using a relative path, use TestContext.CurrentContext.TestDirectory as the location of your file.
try this:
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
In my case was fixed when I changed to this setting
The thing that helped me with such issue - I just turned off NUnit 2.x support in ReSharper settings (ReSharper -> Options... -> Tools -> Unit Testing -> NUnit).
I also turned off NUnit 2.x support and even if it has obviously nothing to do with the problem, it solved it (I have ReSharper 2017.3.20180201.111630)
We are using TestCaseSource in our tests.
So the fix for me in Rider version 2021.1.3 was to change Build-->Unit Testing-->NUnit to Test Runner

C# interactive window in Visual Studio 2015 CTP 6

How I can get the C# interactive window? I have Visual Studio 2015 CTP 6 installed.
And I installed Roslyn, according to these instructions.
According to blog post Using the C# Interactive Window that comes with Roslyn, now I should see C# interactive at
View -> Other Windows -> C# Interactive Window
but it's absent.
Did I miss something?
Now you can have C# interactive in VS 2015!! After waiting it for 3 years!
http://blogs.msdn.com/b/visualstudio/archive/2015/10/08/visual-studio-2015-update-1-ctp.aspx
Wish you happy interactive coding!
Update (Nov 2016): It appears that the C# Interactive tool window has been reintroduced. I am using VS 2015 Update 3, which has it; but it has possibly been reintroduced with VS 2015 Update 1 already.
You missed the fact that the blog articles you link to were posted back in 2011, where VS 2015 was not even on the horizon yet. These articles applied to VS 2010 and (I assume) a very early version of Roslyn.
By the way, CTPs are preview versions of a product. As long as a Microsoft product is in the CTP stage, it is subject to the possibility of rapid and even short-term feature changes. So even if these articles did apply to VS 2015, they would have to be about the exact same version of the product that you are using; otherwise you would have no guarantee that they contained up-to-date information.
See also:
C# REPL feature request for VS 2015 on Microsoft's Visual Studio User Voice site
It appears the C# Interactive window worked for VS 2010 and VS 2012, but was no longer supported in some later versions of VS.
Visual Studio 2015 Update 1 was released, so the Visual Studio interactive window is back for C#.
UPDATE:
Visual Studio 2015 Update 2 has released recently.
According to the talks at Microsoft Build Conference 2015, C# interactive won't be shipped with VS 2015 RTM - But the code is available on GitHub which you can pull, build and install it yourself.
Yes, it is possible now.
In Visual Studio 2015, just go to View, Other Windows, Interactive C# and have fun.
Also, you can check the blog post Interactive C#.
It's available in Visual Studio 2015 update 2.

Categories