I work in a continuous integration environment.
Jenkins build my C# solution and display a lot of warning.
Here is an example of warning display :
In order to fix them, I want to get them in Visual Studio (and use vs' tools to debug them). Unfortunately, my warning list is empty :
How is it possible to configure VS 2012 in order to display MSBuild warning in Visual Studio ?
I already tried this link or this one, but doesn't work.
On the other side, when I browse the Code Analysis complete rules list, I cannot find the previous category :
Your CI Platform should be compiling in Release mode. Are you compiling in Release or in Debug within VS?
Code Analysis rule set are usually different between these two modes.
Related
Starting up a new Unity game project, and using Visual Studio 2019 Community (VS) for my C# development. Unity shows errors in the console window but I find that limiting and inconvenient. I would like to enable all errors, warnings, and suggestions in Visual Studio itself.
I have "Disable the full build of projects" set to false in VS (in the "Tools for Unity" Options tab). I have my error list dropdown set to "Build + Intellisense". Changing any of those flags doesn't seem to do much of anything. I am using Visual Studio 2019 and Unity 2020.2.4f1. I don't see a csproj file or any other project files in VS or Unity or my Windows Explorer. It appears to build because I can play in the Unity editor.
Is it possible to show the errors in VS's Error List window with Unity projects or not? How do I set it up to show errors in VS for Unity projects?
EDIT: One more thing, I am unable to see Intellisense suggestions at all for my project as I write code in VS so it makes coding that much slower and inaccurate.
Found the answer on a different site than StackOverflow and verified it this morning.
In Unity, go to Edit->Preferences->External Tools.
Change the External Script Editor to your instance of Visual Studio.
In the new options below for Generate .csproj files for:, make sure Embedded packages and Local Packages are selected.
Click the button Regenerate project files below and close the Preferences window.
Close Visual Studio.
Double click on any of you scripts in Unity to open up Visual Studio again with your scripts.
You should see your script in Visual Studio opened up with the .csproj files setup for your Unity Project's Solution in the Solution Explorer panel (if you have it open), with the whole project open in Project mode. Go through your Assembly-CSharp solution to see your code (typically within Assets).
Open the Error List panel, and in the drop down, select Build + IntelliSense.
Purposefully make a mistake to see IntelliSense in action producing errors, warnings, and suggestions in the Error List below.
Bonus Step: If you want to granularize the suggestions in the Error List, change your Code Style settings in Visual Studio in Tools->Options->Text Editor->C#->Code Style to change how you wish Visual Studio to prefer to act with your code style. You can look through the C#, C#_LSP, and All Languages to make changes to tabbing, formatting, and so on. Up to you. Remember that Unity 20.2.4f1 supports up to C# 7.3 using the Roslyn compiler (so make code style changes and suggestions as appropriately).
We had this issue and after 4 days testing all the possible solutions we found on the internet we tracked down the problem being that the project's file path had the character "%20", after renaming the folder to a name with only letters and numbers both Visual Studio Community and Rider started working properly.
What steps do I need to take to enable real time compilation and edit and continue? I have several MVC5 C# applications and the features just don't work.
I enabled "Just My Code" and checked "Enable Edit and Continue" in Debugging options. I even tried to reinstall Visual Studio.
In the end I created a new project and copied source files over. It is now working as expected.
Must have been a setting somewhere that I wasn't able to locate.
Background
I am running Visual Studio 2015 Enterprise (RTM) and have enabled the SonarLint extension for code analysis of my multi-project ASP.NET 4.5 MVC solution.
Problem
SonarLint analysis seems to be ignoring the project setting for Code Analysis "Suppress results from generated code (managed only)"
That is, I'm getting a lot of Sonar errors reported back for a couple of *.designer.cs files generated from some .aspx pages. (Most of the project is MVC, for what it's worth.) I don't care about these errors, and don't think I have a decent path for fixing them...
More Details
I have SonarQube integrated with our TFS 2013 environment, and it is correctly ignoring these issues on the TFS server analysis. This problem is just showing up in Visual Studio, using the Roslyn analysis.
Any ideas how I can set up the equivalent of an .ignore file or otherwise fix this?
There is no built-in way of ignoring files in Roslyn at the moment, so you can't do it. Each analyzer needs to decide if the analyzed file needs to be checked or not. Specifically for SonarLint, I've created an issue on GitHub: https://github.com/SonarSource/sonarlint-vs/issues/85. You can track its progress.
I know that this question has been asked several times, and many people here have suggested different answers. Though none of them are working for me.
I created a Windows Forms application with Visual Studio and .NET framework 4.0 and added a breakpoint. However, when I debug the application, an exclamation mark appears on the breakpoint and it says..
The breakpoint will not currently be hit. No executable code is associated with this line. Possible causes include: conditional compilation or compiler optimizations.
I have tried out several suggested solutions
Cleaned the project
Deleted the pdb
Checked the configuration and ensured that it is debug
Set the debug configuration from "x86" to "Any CPU"
Tried creating project from scratch
Tried re-installing .NET framework
Removed temporary ASP.NET files
However, none of them seems to be working. I was able to debug my projects with breakpoints before and for some reason, something happened and I am not able to debug the projects any more. What should I look out for or fix to resolve this issue?
Probably your breakpoint is in a project which is not dependent on the "startup project". Implicitly these projects are not compiled on Run (button F5).
Go to: menu Tools → Options → Project and Solutions → Build and Run → uncheck first check box (only build startup projects and dependencies on Run).
I recently had this problem and it stumped me for a while. Ends up I had inadvertently switched my build configuration away from DEBUG to another configuration that was more optimized and did not "Define DEBUG constant": Project > Properties > Build > (first check box).
This may also happen if other projects in your solution are set to configurations other than DEBUG, usually accidentally, in the Solution Configuration Manager.
In Visual Studio go to the menubar, menu Debug → Windows → Modules, find the assembly your code is located in and check the Symbol state. Chances are you're having Visual Studio loading a different version not matching your PDB files.
I had the same problem here...
I was using Visual Studio 2005 - Professional Edition, and my problem was when I tried to breakpoint a Windows Forms application.
I've searched in many forums on the Internet, and I hadn't found any answer.
But the solution for this problem was easier than I had expected. Just right click on a Visual Studio shortcut (or .exe) and unmark execute in compatibility mode.
Your best option is to create a new project. Then import all the files in the previous project, including your forms if any.
You are now set to OK to continue.
I'm not able to debug my tests using Resharper-Debug option in my project. I have seen this issue raised by lots of people, but has't come across a solid suggestion which solves my issue.
The strange thing is that, if I create a sample project and write a simple unit test, I'm able to debug it without any issues.However when I try to do this in my current project, it simply throws a dialog box saying "Cannot Launch Debugger".I have checked this with my peers, and they does't face this issue :(
Also I don't have any issues while running the test.
It's an XP machine and following is the version of resharper:
JetBrains ReSharper 5.1 C# Edition
Build 5.1.1753.4 on 2010-10-15T15:51:30
Licensed to: XXXXXXX
Plugins: none.
Visual Studio 9.0.21022.8.
Copyright © 2003–2011 JetBrains s.r.o.. All rights reserved.
Thanks,
-M
I occasionally encounter a test that can't be launched with the Resharper debug icon (due to mock objects or 32 vs 64 bit dlls). A solution that works for me is to add an explicit call to launch the debugger in the test
Debugger.Launch();
Then just run the test as normal. When code execution hits that line you get a security popup (pick yes)
then a visual studio choice popup (pick your currently running visual studio).
You'll be dropped into your code in debug mode at the location where you added the Debugger.Launch() line.
Possibly of use to someone stumbling here, specifically, I encountered the error:
---------------------------
ReSharper – Unit Testing
---------------------------
Cannot launch debugger.
Error code: 89710016
Error message: 0
when using R# 8.2 on VS 2013 Pro when attempting to debug NUnit tests.
After finding this link, the issue resolved by changing the NUnit class library project to x86 (Properties -> Build -> Platform Target : x86)
Instead of changing the build properties of the Project to be x86 (which can impact other team members if working on a team), you can tell Resharper to run the unit tests in a 32 bit process.
Resharper -> Options -> Tools -> Unit Testing ->General -> Default Platform Architecture
Set this to "Force tests to run in 32-bit process"
Changing to x86 did not work for me.
What worked was using Managed Compatibility Code in VS (2017) : Tools-> Options -> Debugging -> General -> checking Use Managed Compatibility Mode.
VS Pro 2017 15.7.6, R#2017.3.2