Visual Studio 2013 to 2015, MSB3884, Could not find rule set file

After loading a VS2013 C# project in VS2015 I got the dreaded MSB3884 warning (Could not find rule set file). A little annoying since I wasn’t knowingly using code analysis (but I might now).

Here’s what I did to fix the warning:

  1. On the project properties go to the Code Analysis section.
  2. Select the Browse option on the list of rule sets:
    W10_Test.png
  3. Browse to the VS2015 rule sets folder:
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets
  4. Pick a rule set.. the default used by new projects is:
    MinimumRecommendedRules.ruleset
  5. The new rule set is applied:
    W10_Test.png

Then rebuild – problems gone !

 

 

Advertisements

Python 2.7 stack, OpenCV 3, Visual Studio 2013

I’ve started working with Python (2.7 and 3.x) and OpenCV 3 recently, and the IPython Notebook way of working with inline plots is awesome. But the debugging, editing and some other features are not great when compared to working in a Visual Studio environment.

So now I’m trying Visual Studio 2013 as the IDE, OpenCV 3, and Python 2.7 via the numerical and scientific WinPython stack.

I extracted OpenCV and WinPython to:

  • My Documents\OpenCV
  • My Documents\WinPython-32bit-2.7.10.2

From VS2013 I then installed Python Tools for Visual Studio (PTVS).. I did this within VS2013 using the Extensions and Tools dialog.

Finally I configured a new Python Environment:

W10_Dev

From an Interactive Window I can then check everything works as expected. First, Open CV3:

Python interactive window. Type $help for a list of commands.
import cv2
cv2.__version__
'3.0.0'

Next up, NumPy and a MatPlotLib chart:

import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, np.pi * 2, 100)
y = np.sin(x)
plt.plot(x, y)
plt.xlabel('Radians')
plt.ylabel('sin(x)')
plt.show()

This gives us a popup (model) window:

W10_Dev

Now to make it a bit more interesting – inline plots.. ! The Python Interactive Window has options for the Interactive mode:

W10_Dev

The default Interactive Mode is Standard but we can change this to IPython:

W10_Dev

After restarting VS2013 we can now go inline…

W10_Dev

And lastly an OpenCV 3 test:

In [4]: import cv2
In [5]: img = cv2.imread(r"C:\Users\jon\Pictures\Samples\eye.jpg", 0)
In [6]: plt.imshow(img, cmap='gray')
Out[6]: <matplotlib.image.AxesImage at 0x5b8e510>

W10_Dev

In [34]: blur = cv2.medianBlur(img, 91)
In [35]: plt.imshow(blur, cmap='hot')
Out[35]: <matplotlib.image.AxesImage at 0x1edea7d0>

W10_Dev

The great thing is I can now move this code into a Python project, get it into git, distribute among colleagues, and use the excellent intellisense and debugging powers of PTVS ! (Obviously not this actual code !)

JSON editing in Visual Studio 2013 – tip!

Just installed VS2013 on a clean Windows 10 virtual machine, noticed I wasn’t getting the same JSON editing experience I had on my previous VS2013 installation. The colour coding and auto-completion features were missing.

Solved the problem by modifying the installation and including the Microsoft Web Developer Tools:

W10_Dev

Now the editor uses colour coding, auto-completes the various brackets, and highlights errors.

OS X: IPython Notebooks on an an external drive with Anaconda

Anaconda, running on El Capitan, only provides access to files and folders under the current user’s home directory.

Home

My Dropbox folder lives on an external drive and therefore isn’t accessible from the folder list. (I actually use a slimline 128 GB JetDrive card from Transcend.. fast enough for my 100+ GB of Dropbox files).

The solution was to create a symbolic link in my Documents folder which referenced the external Dropbox folder.

$ ln -s /Volumes/SDCARD/Dropbox ~/Documents/DB

From Anaconda’s perspective this looks like any other folder:

Documents_DB_

WCF HttpListenerException

A problem I’ve had for a while:

Running an application from Visual Studio 2013 without administrator privileges and trying to start a WCF service results in a HttpListenerException.

My service host’s URI was http://localhost:8000.

W8x64_2014

The problem goes away when Studio is started with Administrator:

W8x64_2014

But that’s a pain for me for a variety of reasons.

I googled and found lots of information on stackoverflow. I tried to use the developer-reserved Design_Time_Addresses solution on port 8732, and then on 8731, but to no avail.

So then I figured how to look for this URL on my PC. From a command shell run:

netsh http show urlacl

Then I spotted the design time addresses URL:

W8x64_2014

Port 8733 !

So I changed my URI to http://localhost:8733/Design_Time_Addresses and everything worked.

This new URI is only for use when running the service in a debugged session via Visual Studio. For normal runtime use I still use the original URI of http://localhost:8000.

Update: I’m now using the following property to get the URI at runtime:

static public string ServerPath
{
    get
    {
        string serverPath = &amp;quot;http://localhost:8000&amp;quot;;

        if (System.Diagnostics.Debugger.IsAttached == true)
        {
            serverPath = &amp;quot;http://localhost:8733/Design_Time_Addresses&amp;quot;;
        }

        return serverPath;
    }
}