Skip to main content

Posts

Showing posts with the label VS 2013

Web.config transformations: How to update an appsetting value

Web projects in Visual studio support the concept of web.config transformations, making it easy to update your configuration depending on the build you are using. Yesterday I had a hard time to remember what the exact syntax was to update a specific appsetting. So here is a small snippet to help me remember:

Using work item templates in TFS 2015 and VSTS

Last week I heared a colleague that he had to customize the TFS work item templates to prepopulate some fields with default values. I had some good news for him. TFS (and VSTS) has a nice productivity feature; work item templates. With work item templates you can quickly create work items which have pre-populated values for your team's commonly used fields. And that’s exactly what he needed. Here are the steps required to create a work item template: Open the TFS web portal Go to the Work hub and click on the Queries tab Click on New and choose the Work Item type you want to create a template for On the New Work Item form fill in the default values you want the template to contain. Next, If you are using VSTS choose the Copy template URL option from the context menu: If you are using TFS on premise, click on the Copy template URL button: An URL is generated and copied to your clipboard. Here is an example of the...

Visual Studio 2013–Git integration–Branches are not visible

Last week I was giving training at a customer. To speed up the exercises, I created each exercise on a different branch in Git and used every commit as a step in the exercise. This made it very easy to walk through the exercise step by step and see how the solution is created. The problem was that inside Visual Studio 2013, people only saw the master branch, but couldn’t see any of the other branches I created( note: in other tools, the branches showed up fine): So what’s the reason?   I discovered that the branch dropdown in Visual Studio 2013 only shows local branches, remote branches are not shown. To see the remote branch, you first have to create a new local branch to start tracking a remote branch. Click on New Branch and select the remote branch from the list. Once you’ve done that, the remote branch will appear in the branch list and you should be able to pull it. Once you've done that, this will appear as a "published branch" allowing you to push and ...

NUnit Test Adapter - BadImageFormatException

Yesterday I mentioned that my NUnit tests were not discovered when I set the Build Target to ‘x64’ and that I had to change it to ‘Any CPU’ to be able to run my tests. However this only solved part of my problem as my tests started to fail with the following error message: In theses tests I’m using Noesis.Javascript, a .NET wrapper around Google’s V8 Javascript engine, that allow you to execute scripts directly from .NET code. Noesis.Javascript.dll needs the Microsoft Visual C++ Libraries and to use them, you have to set your Compiler target to a specific platform(x86 or x64). So back to start… After some research, I found a solution: Inside Visual Studio, click on Test –>Test Settings –>Default Processor Architecture This was set to X86. Changing it to X64 solved my problem.

NUnit Test Adapter–No tests found to run

Today I discovered an annoying bug in the NUnit Test Adapter , a Visual Studio extension that integrates NUnit test execution in the IDE. I created some new tests for a specific library, however when I tried to load and run my tests, nothing happened. Inside the output window I noticed the following message: What was causing the issue? When I looked at the Build settings for my test project, I saw that the Compiler platform was set to x64. After changing it to AnyCPU , my tests were discovered…

Could not add Fakes assembly–Fakes assembly already referenced

While debugging the issue with the Microsoft Fakes framework I had yesterday, one thing I tried was to regenerate the Fakes assemblies. First thing I did was remove all generated fake assemblies from the references: Afterwards I right clicked on the original assembly and choose ‘Add Fakes Assembly’: But this failed with the following error message: What I forgot to do was to remove the generated Fakes folder as well. After doing that I was able to regenerate the Fakes assemblies.

Visual Studio 2013–Reinstall a NuGet package

Last week I had a situation where I wanted to replace a NuGet package. The problem was that the NuGet Package version was not updated but the content was changed (I know, not a good idea). So what I wanted is that the system remove the existing package and reinstall it from the NuGet repository.  First thing I tried was the following command: Update-Package –reinstall <package name> The command succeeded but when I checked the content of the NuGet Package it contained still the old content. Afterwards I tried a different approach: I deleted the reference from my project Edited the packages.config to remove the reference to the NuGet package Removed the NuGet package from the file system After removing everything manually, I did a new install: Install-Package <package name> But again, no luck. When I checked the content of the NuGet Package the old content was still there… In the end I was able to solve the issue by clearing the pack...

Visual Studio–Performance profiling a unit test

This morning when running my tests, I noticed that one test was really slow. You don’t want your test suite to be slow as people will stop running the tests when it takes too much time. So time to figure out what is causing this behavior. Turns out that this is is pretty easy in Visual Studio 2013 (and 2015): Open up the Test Explorer window Right click on the slow test and choose Profile Test . This will load a Performance Profiling session for the specific test.

Visual F# Power Tools

If you are an F# developer, this Visual Studio extension is a must have: Visual F# Power Tools . This extension offer a variety of features which makes your development experience so much easier. The feature list: Auto-generating XmlDoc Formatting document / Formatting selection Navigation bar Highlight references Rename refactoring Depth colorizer NavigateTo Syntax coloring Folder organization Find all references Implement interface Record stub generation Union pattern match case generation Resolve unopened namespaces Gray out unused declarations Gray out unused open declarations Go to metadata Task List comments Generate references for F# Interactive Navigate to source Quick info panel More information: http://blogs.msdn.com/b/dotnet/archive/2015/08/05/guest-post-visual-f-power-tools-community-led-tooling-for-f-in-visual-studio.aspx

Visual Studio and Team Foundation Server : Fix bindings in solution file

For some time, I had an error when opening a specific Visual Studio solution. After a problematic merge operation, the Team Foundation Server Source Control binding information inside my solution file didn’t match with the projects I had in my solution. If I opened up the sln file, I could find the following section: Global     GlobalSection(TeamFoundationVersionControl) = preSolution         SccNumberOfProjects = 92         SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}         SccTeamFoundationServer = http://mytfsserver:8080/tfs/defaultcollection         SccLocalPath0 = . The number of projects(92) was complete wrong. Visual Studio told me there should be 68 projects:   I found an easy solution to fix this: Close the solution in Visual Studio Check...

Simplify MsBuild thanks to MsBuild Explorer

MsBuild is a complex beast. It’s easy to get lost inside the XML and hard to discover what exactly is going on. One tool I recently discovered is MsBuild Explorer : Use MSBuild Explorer to help you find your way around the make-up of your build file(s). It presents you with a treeview to see the targets that you have available. A series of tabs provide access to more information including detailed target information, custom target execution, detailed property, item, import and using information and evaluation.  

Tackling Technical Debt with SonarQube and Team Foundation Server

Great news! Just before all the big announcements at Build, the Microsoft  ALM team announces the availability of a set of integration components that allow you to configure a Team Foundation Server (TFS) Build to connect to SonarQube. SonarQube is an open source platform that is the de facto solution for understanding and managing technical debt. Although SonarQube had a C# plugin before, with the new set of components it becomes really easy to share the following data: results of .Net and JavaScript code analysis code clone analysis code coverage data from tests metrics for .Net and JavaScript In addition, SonarSource have produced a set of .Net rules, written using the new Roslyn-based code analysis framework, and published them in two forms: a nuget package and a VSIX . This makes it possible to run the same set of rules in SonarQube AND directly in Visual Studio. More information: http://blogs.msdn.com/b/visualstudioalm/archive/2015/04/28/technical-d...

Visual Studio: Improve your build output with Project Hero

By default the Build output window in Visual Studio is not very user friendly. If you have a large project, you have to scroll a long list of output information to find relevant information. Project Hero, you have to love the name, a free Visual Studio Extension tries to solve this. Project Hero is a simple and easy to use plugin that allows you to see the build/clean status of projects in your solution in a clean and visual way. The need for findinga better alternative than the Output Window for large solution build notification drove this effort. I then landed upon Marius Bancila's plugin and that was no longer supported and hadn't been updated in years, and with no source code available I started from the drawing board.

Bower - ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/angular/bower-angular.git", exit code of #128

I’m currently switching from NuGet to Bower as my client side package manager. The process is not going as smoothly as I hoped. During the process I got a range of problems. One of the problems was that Bower throw the following error when I tried to install the Bower packages: ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/angular/bower-angular.git", exit code of #128 On StackOverflow I found some solutions that mentioned altering your global git config, but I would prefer not to do that if possible. So how did I fix it? I opened up a command prompt, browsed to the location of my bower.json file  and tried to do a bower install from there: And this succeeded! Now I moved back to Visual Studio and invoked Bower from there. And believe it or not, it worked . Anyone with a clue why this fixed the problem?

Bower - ENOGIT git is not installed or not in the PATH

I’m currently switching from NuGet to Bower as my client side package manager. The process is not going as smoothly as I hoped. During the process I got a range of problems. One of the problems was that Bower throw the following error when I tried to install the Bower packages: ENOGIT git is not installed or not in the PATH This one is easy to fix, just add the path to Git.exe to the PATH environment variable.

Angular.js IntelliSense in Visual Studio

Today Visual Studio already offers you Angular.js IntelliSense. However it’s functionality is limited to a standard list of keywords and doesn’t recognize your own directives, controllers, etc… This is because the JavaScript editor doesn’t understand the way that Angular dynamically loads object references when your app is launched. John Bledsoe , a member of the Visual Studio community, created a great extension that helps the Visual Studio editor with this. By simulating the execution of your Angular application as you write your code, it provides a significantly better IntelliSense experience. How to use it… To get started, you need to install the AngularJS extension for Visual Studio. To do this, download the angular.intellisense.js file and place it in the Program Files (x86)\Microsoft Visual Studio 12.0\JavaScript\References folder. More information about this extension can be found here: http://blogs.msdn.com/b/visualstudio/archive/2015/02/05/using-angularjs-in-visual-s...

Pickles–Generate documentation from your SpecFlow tests

I’m a big fan of SpecFlow, a BDD framework that allows you to write your tests as executable specifications. A colleague mentioned another tool, Pickles , that generates documentation in a variety of formats from your specifications. Time to give it a try… Installing Pickles The easiest way to integrate Pickles in your project is to download it through NuGet. So let’s do that first: Install-Package Pickles This will download the Pickles Powershell DLL and load it in the Package Manager shell. Running Pickles from Powershell Let’s write some Powershell code to test Pickles. First initialize some variables to simplify the readability: And now invoke the Pickle-Features command: You should see similar results like below: Let’s have a look at the generated results. You get a nice website which shows you all the features and their test results: Specflow also supports other formats then HTML. Here is the full list: HTML DHTML (javascript-enabled, ...

Visual Studio 2013–SQL Server Data Tools error: SQL71501: User: [user] has an unresolved reference to Login [user]

After importing a database using the SQL Server Data Tools in Visual Studio, I got a compilation error on my database project: SQL71501: User: [user] has an unresolved reference to Login [user] The SQL Server Data Tools by default only import the database specific objects. A database login, which is a global database server object, is not imported. This explains the error. But how can we fix this? In previous versions of the SQL Server Data Tools, you had 2 types of Database Projects; the normal Database Project and also a Database Server project. However in VS 2013, the Database Server project no longer exists. So we need a different solution. I first tried to solve it using Schema Compare.  I clicked on the 'Options' button in the Schema Compare window and selected the "Object Types" tab. There I choose to include logins. But when I ran the Schema Compare, it didn’t made any difference.  I probably did something wrong, but as I was short on time, I took...

TypeScript build server error: "tsc.exe" exited with code 1.

After configuring a Continuous Integration build for a TypeScript enabled web application, the build turned red with the following error message: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript\Microsoft.TypeScript.targets (118): "tsc.exe" exited with code 1. On the build server I had installed the TypeScript components for Visual Studio 2013 , but for this particular project we were still using Visual Studio 2012. I was able to fix the problem by installing the TypeScript 1.0 Tools for Visual Studio 2012 on the build server.

Angular.js templates inside Visual Studio: SideWaffle Template Pack

If you want to save some time when building Angular.js applications, have a look at SideWaffle . SideWaffle is an extension for Visual Studio. It contains both item- and project templates suitable for building websites, Windows apps, Windows Phone apps, WPF, Visual Studio extensibilty project and a lot more.  More information can be found at the official website: http://sidewaffle.com/