I've seen a lot of things about VS2015 mention this feature, where is it in VS2019?
In VS2015 it was under build options but I can't find it anywhere now.
I found an answer, under project properties -> C/C++ -> Preprocessor there is an option called "Preprocessor Definitions" which was what I was looking for
Related
I am using visual studio 2019 in mac to setup my test automation framework in c# & Specflow . When i build my test automation framework in VS i am getting below error :
SpecFlow designer codebehind generation is not compatible with MSBuild codebehind generation. The custom tool must be removed from the file
On searching through forums, people recommending to remove the custom tool selected as "SpecFlowSingleFileGenerator". But when i check the same in VS 2019 for Mac it is not enabled for me to remove.
attaching the screenshotn. Can anyone help me with this issue ?
I'm not familiar with Visual Studio for Mac, but presumably the settings are the same or similar to Windows.
Check the SpecFlow options in Visual Studio. Make sure Enable SpecFlowSingleFileGenerator CustomTool is set to False. If Visual Studio for Mac is anything like windows, go to Tools > Options > SpecFlow, then look under the Legacy section.
A screenshot from Windows is below, showing the setting in question:
I am using Visual Studio 2019 16.8.1 and the project targets NET 5.0.
The whole code section is highlighted. Is this normal?
I just re-opened the file/re-opened Visual Studio. #Brian Yes there was ambiguity but i think a broken build somewhere
We have an issue with Visual Studio 2019 found when trying to pre-compile our ASP.Net project during publish. We got errors such as:
error CS1056: Unexpected character '$'
When I look at the view, it is using string interpolation.
All the projects in this solution are set to target full .Net Framework 4.6.1. From what I read, that should default to C# 7.3 compiler.
I have updated the DomCompiler and Compiler packages to version 3.6.0. In the web.config I tried to set c# version to both default and 7 specifically. The error occurs no matter which one is used.
I also tried to add LangVersion to the .csproj file and specify 7, but that didn't work either.
If we deploy not pre-compiled these views work, so the run time on the server is usually the correct c# compiler version. This is only a dev time and build time issue.
Visual Studio 2019
Visual Studio 2019 chooses the language version by default:
Right click on your project and select Properties
Choose Build and click the Advanced button
click on Why cant's I select a different version?
The latest C# compiler determines a default language version based on
your project's target framework or frameworks. Visual Studio doesn't
provide a UI to change the value, but you can change it by editing the
csproj file. The choice of default ensures that you use the latest
language version compatible with your target framework.
If you want to override the language version you have 3 options:
Manually edit your project file.
Set the language version for multiple projects in a subdirectory.
Configure the -langversion compiler option.
The first option seems to achieve your goal, open the project file in your favorite text editor and add the language version, e.g:
MyProject.csproj
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<!--<LangVersion>preview</LangVersion>-->
<!--<LangVersion>7.3</LangVersion>-->
</PropertyGroup>
</Project>
Visual Studio 2017
Right click on your project and select Properties
Choose Build and click the Advanced button
Here you can choose your Language version
Change language version for all of the projects at one go
If you have several projects in your solution and you want to create a configuration to change the language version for all the projects at one go, then you need to create a file name Directory.Build.props at the root of your repository. You can configure the language version in this file, for example:
Directory.Build.props
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<!--<LangVersion>preview</LangVersion>-->
<!--<LangVersion>7.3</LangVersion>-->
</PropertyGroup>
</Project>
See this question for detailed explanation.
You can not use c# 7 with .Net framework projects targeting 4.6.1. It does not matter which visual studio version you're using.
Please check this link:
https://www.tutorialsteacher.com/csharp/csharp-version-history
I had the same problem (not being able to use all language features) while using (.net 4.5.2)
I am using Visual Studio 2017 Pro, and i am being driven crazy by the lack of syntax highlighting for the Jenkinsfile in my project. I am using the Declarative Syntax, but i just cant seem to find anything on getting this to work. My research says that its based on groovy, but i dont see a way to map it to that language either. Any help is appreciated.
This might not be a solution for everyone, but for me, it worked:
Jenkinsfiles are the only files without extension I am working with, therefore I opened
Tools -> Options -> Text Editor -> File Extensions
and then, I checked "Map extensionless files to:" and selected "Javascript Editor"
This does not require to install any extension and the display is great
I am in the same boat. Using Visual Studio 2017 Enterprise.
I found this extension recently for Visual Studio Code and this extension for Visual Studio.
I'm trying to use MathNet.Numerics in an F# project, and I can't seem to add it as a dependency. If I go to "Manage NuGet Packages," I can install it, but I can't add it to my References; IntelliSense and the compiler then both tell me that it can't find the package MathNet.
Problem solved - I had installed MathNet Numerics instead of MathNet Numerics for F#. Also I might not have saved my project before closing it.