Code Analysis Warnings Does Not Warn While Check-In TFS 2010 - visual-studio-2010

We have upgraded our TFS 2008 to TFS 2010 and our VS 2008 projects to VS 2010 in last weeks.
We are using Code Analysis to improve our coding quality.
But we have some problems about Code Analysis Check-in Policy.
When we run code analysis on project, we get warnings about code analysis. But if we try to check-in without fix it, we expect to warned about policy fails by VS 2010; but VS 2010 does not warn us and TFS 2010 accept check-in.
So how can we solve this.
We want that team members warned about code analysis warnings before check-in if project has.

There is an easy way to do this, but you may not like it.
Create a Code Analysis list in your solution
Figure: You can add Code Analysis configuration to a solution
Configure the rules
Figure: Setting Rules to error will prevent a build from succeeding
Now that you have this configured you will be able to set some of the rules to error out and thus preventing check-in based on the Build not being successfully.

Related

MSBuild compiler warning for javascript debugger statement

There has been more than one occasion where I have mistakenly left a debugger keyword in a javascript file, and rather than finding these (or not) in code reviews, I'd quite like the Visual Studio build process to warn me about this so I remember to remove them - especially in a Release Mode build.
Likewise, maybe some warnings about console.log type of code.
How can I generate an MSBuild warning/error for this?
MSBuild compiler warning for javascript debugger statement
Just like as mentioned in the previously deleted answer, this issue should be more related to the Visual Studio extension rather than MSBuild.
You can use the Visual Studio extensions:
JSLint for Visual Studio
JSHint for Visual Studio
I'm currently using the JSLint from the link above and it works great.
Here are some screen shots of the settings / and my code with an
error. It won't prevent you from checking in, there would likely need
to be a check-in policy on the TFS server, but it will notify you of
the error when you build and save.
Here is the initial page where you can specify how to display the
JSLint validation messages. All of the options across the top you can
set to your liking. You can cancel the build and run the lint process
during save and / or build.
These are all of the specific JSLint rules that you can turn on or
off. I have highlighted the debugger rule that you asked about in your
question.
Certificate: Don't let check in with “debugger” in Visual Studio 2012
Hope this helps.

How do you test a custom VSTS/TFS Check-In Policy in Visual Studio 2017?

I am working on creating a customized VSTS/TFS Check-In Policy. I followed the guidance given from this answer on how to create the check-in policy. Basically, I downloaded the source code from Colin's ALM Policy and made a few modifications to see if I can get it to work.
When I build the installer (vsix) and install the extension, this works just fine (tested against VSTS). However, I want to be able to debug the policy so that I can make modifications and bug fixes more quickly.
The answers given to a similar question seem to work for Visual Studio 2015, however this does not work for Visual Studio 2017; if I set the debug start action to launch Visual Studio 2017 devenv.exe, the check-in policy does not show up. The same check-in policy shows up with Visual Studio 2015 though.
I'm looking for any guidance on how I can debug this check-in policy utilizing Visual Studio 2017.
There is test project (ColinsALMCheckinPolicies.UnitTests) that you can debug. So just need to add breakpoints to the source file, then debug the test method (right click a test method > Debug test)
I hate answering my own question, however I feel it is necessary since this answer helped me out; I found the answer from the MSDN documentation :The Experimental Instance.
Basically, under the VSIX Installer project properties, simply setup the Debug start action and command line arguments using the /rootsuffix Exp argument:
If you do this, it launches the Visual Studio Experimental Instance with the VSIX already installed, and it attaches the process to your development environment too, which allows you to debug your extension.
Also, I agree with the other answer to this question, https://stackoverflow.com/a/43672469/347172, suggesting that a unit testing project will be highly beneficial. It definitely will help to ensure that your code is properly unit tested and working too.

VS2013 Adding Types to Code Map forces Rebuilding Projects

We have a large solution (112 projects) in VS2013 Ultimate.
I love the Code Map feature, however when I am dragging types onto a Code Map dgml it insists on building the solution - even though I have not made any changes.
I can't see many options for this great feature, but is there anyway to tell it to stop building the solution everytime I add a type to the diagram?
This is a known issue and major complaint with Code Map in Visual Studio 2013. It affects certain types of projects (like ASP.NET ones) more than others because these projects always report that they have changes and need to be rebuilt.
The experience is improved in Visual Studio 2015 Enterprise, as we have added a "skip build" option.
We've made many improvements to CodeMap in Visual Studio 2015, so it's definitely worth getting it if you use Code Maps. Note that you can install VS 2015 along side VS 2013, so you don't have to migrate projects etc.
I see the code map document window in VS 2015 now contains a button labelled "Skip Build" which seems to solve this problem

Visual Studio 2010 - TFS - Work offline also TFS server is available

I'm working in a big project in Visual Studio 2010. Often I must wait the check-in before doing simple test. How can I work with Visual Studio 2010 offline when TFS Server is available?
I'm not sure I understand your question 100%, but there are a couple of options depending on what you mean.
First of all, working offline is not possible with TFS 2010, but is available with local workspaces in TFS 2012 (overview in this article)
You say that you're waiting for check-in to complete. If you have a plain check-in situtation, then you have a couple of choices:
You can open a second instance of Visual Studio, and work while the first instance completes the check-in.
You can open a command prompt and use tf.exe checkin in your workspace directory.
If you have a gated check-in, then you can check the 'Preserve my pending changes locally', and you will be able to keep working on the changes until they have been validated and checked in. (further details in this article)
All that being said. A simple check-in should not take more than seconds. So if you're waiting a long time for a normal check-in situation, then you might have some performance/server issues.

Team City and Visual Studio 2010 and Coverage Tool

In my team we shall use Visual Studio 2010 and .NET 4.0 as soon as possible and I have a question regarding VS 2010 and Team City.
In VS2010 there is a simple tool to measure mstest coverage. Question: Is it possible to read the result of ms-Coverage from team city?
If yes, how do we set up that configuration.
best Regard
Henrik
Yes, you can use the vsinstr.exe and vsperfmon.exe command lines tools to generate coverage data. See Code Coverage with Visual Studio.
Once you have the code coverage files, you need to get TeamCity to report the data. This article should get you started, in particular, look under the "Configure TeamCity to display statistics" header.

Resources