Why doesn't the Code Contracts tab appear in VS 2010? - code-contracts

I saw a demo of Code Contracts the other day and decided to give it a shot in a little test project.
I can setup my Code Contracts code appropriately after adding a 'using System.Diagnostics.Contracts' statement to the classes, but the contracts don't seem to be enforced.
Is there a reason why I don't see the 'Code Contracts' tab appearing on the project properties screen?

You need to install the Dev Labs toolkit in order to get the Visual Studio Integration to show up.
Code Contracts are part of .Net 4, but the tooling isn't part of VS 2010 by default.
It can be downloaded from here : http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx

Related

Is there a simple "hello world" sample Office 365 Excel add-in guide?

Is there a simple "hello world" sample for coding an Office 365 Excel add-in that I can follow and customize?
I am assuming that you would like to build an Excel add-in that can be run in Windows/Mac and Online. So you could use Yeoman generator to build "hello world" sample code easily. The Yeoman generator creates a Node.js project that can be managed with Visual Studio Code or any other editor, whereas Visual Studio creates a Visual Studio solution. Select the tab for the one you'd like to use and then follow the instructions to create your add-in and test it locally.
This article will walk you through the process of building an Excel Taskpane Add-in in Yeoman generator.
You could also explore API capability using Script Lab.
Script Lab is a useful tool for anyone who wants to learn how to develop Office Add-ins using the Office JavaScript API in Excel, Word, or PowerPoint. It provides IntelliSense so you can see what's available and is built on the Monaco framework, the same framework used by Visual Studio Code. Through Script Lab, you can access a library of samples to quickly try out features or you can use a sample as the starting point for your own code. You can even use Script Lab to try preview APIs.
Well it depends on what you mean by an Excel add-in I guess. There are a lot of options here.
If you're talking about a simple add-in written in VBA, which doesn't require any additional tools to get started, there are lots of tutorials available online.
You could take a look at this simple getting started tutorial:
How to Create and Use an Excel Add-in
If you want to know more about there is to developing office (excel) add-ins i'd encourage you to take a look at the developer docs from microsoft:
https://learn.microsoft.com/en-us/office/dev/add-ins/
https://learn.microsoft.com/en-us/office/dev/add-ins/excel/
The nice thing about this approach is that it's designed to be cross-platform and enables you to create add-ins by using web dev technology. If you're more interested in using visual studio and VB.NET / C# I'd start by exploring the VSTO Add-ins route. Start at the docs or use google for getting started tutorials yourself. The VSTO docs can be found here:
https://learn.microsoft.com/en-us/visualstudio/vsto/excel-solutions?view=vs-2019
Or jump right in and start here: https://learn.microsoft.com/en-us/visualstudio/vsto/walkthrough-creating-your-first-vsto-add-in-for-excel?view=vs-2019
There are three common ways to create an Excel 365 JavaScript Add-in:
(1) You could use the Yeoman Generator (with Visual Studio Code)
(2) You could use the Office Templates (with Visual Studio 2019)
(3) You could use NPM and Webpack (with Notepad)
You can find simple "Hello World" examples of all three here:
https://bettersolutions.com/javascript/excel-api/index.htm

Visual Studio 2017 - Unable to generate class diagram from existing code

I have created a .NET Core server project that has a lot of classes. I need to generate a class diagram UML, and when I look on the Microsoft documentation site (I think it is only for vs2015), it tells me to click on the "Architecture" menu and click "Add New Diagram", but I couldn't find this button or function anywhere.
Is this function not supported anymore, or have they just not added this function yet? All the forums kept reporting it as a bug, but there's no workaround stated in the forums.
I am open to suggestions. Also I am using VS Enterprise.
Sadly Microsoft removed this functionality in VS 2017.
https://blogs.msdn.microsoft.com/visualstudioalm/2016/10/14/uml-designers-have-been-removed-layer-designer-now-supports-live-architectural-analysis/

Different version of VS2012 requires project migration?

I have a project that was created using VS2102 Premium. When a co-worker tries to open it with VS2012 Professional he gets a "Needs migration" message for the project. Is this due to the different flavor of VS2012?
I wouldn't have thought so for most projects, however if you've used some feature of VS Premium that is not present in VS Professional, then I guess this is the response you'll get.
If you open a project from a previous version (eg 2010) then it'll offer to upgrade the solution.
You can manually edit the project, its only an XML file. Create a new blank project to see the structure and then use winmerge or similar to copy relevant lines across.

how to migrate visual studio C# app to monotouch

I have an existing application developed using Microsoft Visual Studio 2010 C#. I just purchased Xamarin's Monotouch product which allows me to use their IDE MonoDev to create iPhone/iPad applications from scratch by coding C#. Right now I don't want to code a new application. I want take my existing C# application import the source into monodev/monotouch and have the result run on the iPhone/iPad. My existing C# application is designed for deployment on Android phones/tablets using Xamarin's Android product. It works great! I have begun wading into the Xamarin documentation, samples, tutorials etc. But I need to port the existing application to iPhone/iPad right now, right away. I really don't have the luxery to spend time learning from scratch. I've got to belive someone has already gone down this migration path. If you have can we talk, email, or do you know if there is a guide describing the specific steps to take to accomplish this?
TIA
Xamarin MonoTouch does not allow you to run any C# application and run it immediately on an iPhone. The UI layer is native, so the C# code that constructs the UI must use the Xamarin bindings onto the Apple UI APIs.
The 'standard' migration process is to create an empty MonoDevelop project then start adding your existing C# business logic files, resolving any compilation issues as they arise.

Is code coverage available in VS2012 for metro-style apps?

I am using Windows 8 Pro and Visual Studio 2012 Ultimate (both RTM).
I create a Metro-style class library, and then a corresponding unit test library. Both target WinRT (not the .NET framework).
I can run unit tests fine, but when I attempt to "Analyze code coverage for all tests", the output window comes up with the results of the rebuild, and that's it. The Code Coverage Results window is all grayed out.
From reading on the web, some have alluded to the idea that code coverage is not enabled for WinRT assemblies, but I cannot confirm. I have also tried creating a .testsettings file, like was needed in VS2010 and explicitly turn on code coverage, and I got the same results.
Can anyone confirm or deny that code coverage is not available for WinRT-targeted assemblies, in VS2012 RTM?? I'm just trying to figure out if I'm missing some setting - or if it's not possible.
It's not possible at this stage due to the sandboxed nature of WinRT apps.
P.S. It's on the list of things the team is looking to resolve in the near future (no, I don't have a timeframe for it)

Resources