Automatically enforce Code Analysis policies in Visual Studio 2008 - visual-studio

Our team are looking into implementing Code Analysis as a check in policy in TFS.
We've decided on which rules we want to enforce but won't be applying the policies to TFS for a while as we are currently migrating to TFS 2010.
In the meantime to get used to it and start removing Code Analysis warnings the dev team are going to start manually enabling Code Analysis.
So, is there a way we can publish or automatically enforce a set of rules without having to manually edit the properties for every project in every solution?

For sharing Code Analysis settings between projects in VS 2008, see
http://blogs.msdn.com/b/codeanalysis/archive/2006/11/16/faq-how-do-i-share-managed-code-analysis-rule-settings-over-multiple-projects-david-kean.aspx. (The article was written for VS 2005, but the same approach is appropriate in VS 2008 as well. In VS 2010, use of a shared rule set file is a better approach, although it may be specified using the same imported target mechanism.)

Related

VS 2013 Create Per-User Publishing Settings

We've recently upgraded to Visual Studio 2013 and we're having some issues with the new way publishing is handled. Previously, (in VS 2010) every user had their own local publishing settings, but in VS 2013 it's changed to the idea of shared publish settings. This is causing problems with our environment because every developer has a different local dev environment (paths, connection strings, email addresses to send things to). I realize this is not the optimal way to have things set up, but that's the reality of our situation right now.
We use config transforms to handle the various web.config changes for different developers, so just running through VS doesn't work for us because it doesn't run the transforms. This also causes a problem with the VS 2013 publish settings because the last build config used is stored in the shared publish settings. In order to keep all our settings different, it looks like we're going to need to have a different publish setting for each developer now as well (such as "Local - Erik", "Local - OtherDev"). This is just going further down a path I'd like to get out of eventually.
So my question boils down to: Is it possible to somehow disable the shared profile settings? I thought of just not including them in version control, but then Visual Studio complains that the files are missing on other developers' systems.
Thanks for the help!
You can do this by excluding the profile from the project after you create it. The publish wizard looks for any profile on disk, but newly created ones are added to the project by default. If you then exclude the .pubxml file from the project and remove it from source control, it shouldn't bother you again.

How to configure FxCop rule and run it using FxCop Runner in VS2010 Profesional

I've this environment:
I'm using "FxCop 10" and "Visual Studio 2010 Profesional". I connected the FxCop to Visual Studio 2010 Profesional using "FxCop Runner".
This is my purpose:
I want to disable some rule for my project, and integrated it with others projects (in the same solution). I also want to save that configuration in source control, so my team member can use it easily.
And this is my experience:
As StyleCop can generate the "Settings.StyleCop" file and can be referred by other projects.
My question is:
can I do the similar way for FxCop?
Regards,
Aditya
FxCop supports two mechanisms for this. The first is a .fxcop project file, which can be created via the FxCop UI application. This is probably your simplest option.
The second approach is a .ruleset file, for which the UI editor is Visual Studio Premium or Ultimate for VS 2010 (or Professional if you have VS 2013 as well). If you don't have one of these editions, you could edit a .ruleset file manually since it's just XML, but it sounds like there's no reason not to use a .fxcop file in your case.

How to specify the source control plugin on a per-solution basis in Visual Studio?

I just installed AnkhSVN to have subversion support from within Visual Studio 2010.
I noticed I had to go to Tools > Options > Source Control to select the current source control plugin.
At the moment, I'm working on multiple projects using different version control systems. For instance, I also have some projects in Mercurial, for which a VS source control plugin is available.
Is there any way to specify the source control plugin on a per-solution basis? Or can VS detect the used vcs automatically? What are the best practices in this respect?
Edit: a google search led me to How to configure Visual Studio to use different source control providers and Can Perforce and SourceSafe co-exist in Visual Studio?. Both cover the same ground, but appear to be specific to specific vcs and lack a satisfying general answer. I'm looking for a general answer here.
There is unfortunately no good answer here. You will simply have to go in and manually change you visual studio source control provider settings before you open the project. This is a limitation of how this particular plugin system works, and will probably take a new version of visual studio to specifically address it.
This is an instance where visual studio works better for the enterprise shop with standardized source control tools, and not as good for a contractor working with multiple clients across an array of technologies.
Source control provider auto switching based on reserved directory presence can be done with a VS extension as described here.

Visual Studio 2008 SP1 and upgrading a BizTalk 2006 R2 project to BizTalk 2009 Project - Failing

Greetings all,
I have posted this on the MSDN managed news groups as well as a BizTalk site, but I am not sure they get enough traffic that as I don't seem to be getting a response.
Help me StackOverflow, your my only hope.
I am in the process of upgrading our Visual Studio BizTalk projects from BizTalk 2006 R2 to BizTalk 2009.
I start VS 2008 SP1, load up the VS 2005 solution with all our VS 2005 artifacts in it, and the Visual Studio Conversion Wizard starts. All good to here.
The wizard properly reports that the projects which will be updated. These look good. I press Finish and the conversion tool goes and does its conversion thing. The wizard reports that all projects have been converted successfully, However when I view the conversion log, it says that none of the BizTalk projects were converted. If I expand the node on of the non-converted projects, there is no error information as to why it didn't convert.
The two biztalk projects in the solution (the others are c# projects) are both greyed out and VS.Net 2008 says they are unavailable.
If I then right click on the project and select "Reload" the conversion wizard comes up again, this time it asks to create a backup before converting. I select yes to the default location and hit Next. It tells me it's ready to convert, when I hit Finish I get the nice little dialog window:
The operation could not be completed. Unspecified error.
If I look at the conversion log this time, I see the error: Conversion Issues - your.project\your.project.btproj: Error converting project file. Child element <BIZTALK> of element <VisualStudioProject> is not valid.
There are a couple of posts on the net about this issue but no concrete resolutions:
http://dennismulder.net/cs/blogs/dennism/archive/2009/04/25/trouble-migrating-from-biztalk-2006-r2-to-2009.aspx#comments
http://msdn.microsoft.com/en-us/library/dd257156.aspx
The msdn article mentions the project needing a solution file, so I can't see how that applies as the project is already part of an existing VS 2005 solution.
Does anyone have some ideas/thoughts on this? If I have to, I can resort to just creating new BizTalk projects and re-adding the BizTalk artifacts to them, but we have a number of solutions which will need to be converted and if there is a simple fix to get the conversion wizard to work, I would rather go down that route.
Thanks in advance all.
cmb..
** Update - 20090806 **
After some cutting and pasting of .btproj files I have determined the upgrade wizard does not like the fact that I renamed my project build name from Development to Debug
Greetings,
Ok, I openned an incident with Microsoft about this.
Basically the issue in my case came down to the fact that I renamed the build configurations from Development and Deployment to Debug and Release (to match what every other Visual Studio project calls their build configurations). Apparently, the upgrade wizard for BizTalk, doesn't like this very much.
Anyways, Below is the summary email I received from the support engineer at Microsoft about what the problem is and how to fix it. It comes down to hand tinkering with the .sln and .btproj files. Alas..
The default configuration names
(Development and Deployment) for
BizTalk project should not be
modified. Up to BizTalk 2006 R2 it was
not a “true” integration of BizTalk
project systems with the visual studio
in many ways. For that matter, from
supportability point of view, changing
the default configurations is not
recommended. However, you can add your
own configurations without altering
the default configurations. Also it is
not supported modifying the BizTalk
Project template files for Visual
Studio.
In your case, you have re-named the
default configuration names to some
other values. Because of this change
entries for those configuration were
not appearing in the metadata under
various VS files. I tried playing
around with those setting and
eventually with following steps got
the project upgrade working for the
sample project that you provided.
For solution file under GlobalSection(SolutionConfigurationPlatforms)
= preSolution section I did not see entry for default Development
configuration. Added following entry
there Development|.NET =
Development|.NET (here we need default
entries for deployment and
development)
For solution file under GlobalSection(ProjectConfigurationPlatforms)
= postSolution I did not see entry for default Development configuration.
Added following entries there
{3B54116C-9D09-4DAF-9AFD-62EDA64AC12A}.Development|.NET.ActiveCfg
= Development|.NET {3B54116C-9D09-4DAF-9AFD-62EDA64AC12A}.Development|.NET.Build.0
= Development|.NET (here we need default entries for deployment and
development)
For project file under section did not see section
for default Development configuration
Added following entry there (here we need default entries for deployment and
development)
Delete user options file (as it is not needed for the upgrade process –
VS will create the one when you open
the project)
Opened the project on BizTalk 2009 VS 2008 box. Upgrade process is
successful.
The GUIDs are specific to BizTalk
project files. If there are multiple
BizTalk project as a part of the
solution, you have to add the entries
for default configuration for each and
every project in the solution.
can you confirm whether or not you have checked the readonly attributes on all files in the project.
i had the same problem because it was trying to convert a file that was under source control, exactly as laid out in that one link u provided.
after removing the source control bindings i ran the conversion again and it worked
Found this issue when I searched for the current problem I have with BTS09/VS2008 which is I can't add BizTalk projects to a solution, what is going on anybody know about this one
I have been wittering on about the conversion problem since the launch of BTS09/VS2008 nobody seems to have taken me seriously I believe Dennis Mulder was going to raise the issue with Microsoft but haven't heard anything back. As you have found the Microsoft response is just not worth bothering about, if you are converting from BTS06 to 09 then it's a fair chance you will have a sln file, also removing the source control elements didn't work for me either, I actually opened a solution in vs2005 removed all the source control elements and save the solution, then did a conversion to vs2008 didn't work. One very interesting point one of the solutions I tried converting, some of the BizTalk projects did get converted some didn't, spent hours trying to see where the differences once again to no avail. You obviously can create new solutions/projects and add the in the relevant artefacts to these projects BUT WHY should we need to do this, this to me could be a potential showstopper in organisations that have many or large solutions to convert.
Microsoft needs to take this problem seriously and come up with a solution.
My take on this is that it really highlights how many people have moved to BTS09 NOT A LOT if so then I am sure there would have been a resolve to this by now.
Jim,
There are few things. From Dennis Mulder blog post and comments, it looks like Dennis problem is sorted by removing the source control bindings. He is not going to raise a support ticket with MS, he suggested you to open one if required.
In the MSDN page http://msdn.microsoft.com/en-us/library/dd257156(BTS.10).aspx it clearly states the supported migration path is only from BizTalk 2006 R2 to 2009. There is no support from BizTalk 2006 to 2009.
To address your very first line "I can't add BizTalk projects to a solution", Are you able to create new simple BizTalk projects in VS 2008 without any issues?The reason I'm asking this is, there is a chance you might have installed BizTalk and VS in wrong order. It may be worth reinstalling just the developer components of BizTalk Server.
This problem exists in 2010 also when migrating 2006R2 solutions to BizTalk 2010.
I have found a method that works with the least amount of effort possible. It does not require two environments (old and new) but does require the original, unconverted solution-files to work.
http://justbizzie.blogspot.com/2010/10/migrating-biztalk-2006r2-sources-to.html
Let me know if this is also good when migrating to 2009. I expect it to be :)

Integrate Visual Source Safe with Visual Studio without using source control binding

Is there a way to integrate Visual Studio with VSS without doing source control binding?
The problem I have is that my team is opposing to add source control binding to the solution and project files, since they claim it adds more problems (restrictions) for them.
On the other hand, I really like to perform most of the source control operations from Visual Studio.
Is there any way to have the solution file and all the project files the way they are (without added binding to VSS) and still have VSS and VS integration without forcing other team members to use that integration.
I don't see a way to do it per project.
You can however you do it for IDE (all projects loaded).
It is under Tools\Options\Source Control
and then set Binding to None.
I see it in VS 2005 and 2008. I gave it a try in a project I wanted to convert from VS2005 to 2008 and appeared to work (I did not want to check in/out files for conversion).
The answer to your question is "no." Bindings and VS integration are one & the same with SourceSafe. I'm not even sure what it would mean for a solution to be integrated but not bound, or vice versa. What exactly are your teammates looking for?
You can adjust bindings per-project in the File -> Source Control -> Change Source Control dialog. You can also adjust them per-user (effectively; not a supported configuration) by excluding the *scc files from source control. However, you are likely to encounter problems down the road if you try to manage these files yourself instead of using the Add Solution To SCC wizard. More info:
http://alinconstantin.dtdns.net/WebDocs/Scc/_Bindings.htm
http://alinconstantin.dtdns.net/WebDocs/Scc/_WebEnlist.htm
The binding is stored in the .vssscc, .vspscc and MSSCCPRJ.SCC files.
If you don't add these files to Visual Source Safe every developer can configure his bindings like he wants.
Since we use Perforce, I'm not 100% sure if this works with VSS.

Resources