net, vs comments edit

In FxCop 10 you could run code analysis without installing Visual Studio by either grabbing just the FxCop stuff out of Visual Studio or installing the Windows SDK.

Not so, with FxCop 11. There’s no longer a standalone installer - it’s been removed from the Windows SDK.

I tried grabbing the FxCop out of Visual Studio 2012 and it fails with the exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.CodeAnalysis.Interop.dll' or one of its dependencies. The specified module could not be found.

Using Dependency Walker on Microsoft.VisualStudio.CodeAnalysis.Interop.dll, you can see a ton of missing assembly references:

  • msvcp110.dll
  • msvcr110.dll
  • ieshims.dll
  • mf.dll
  • mfplat.dll
  • mfreadwrite.dll
  • wlanapi.dll

The msvc*.dll assemblies are part of the Visual C++ redistributable, so I tried installing that and it did fix those issues. The ieshims.dll is part of Internet Explorer, so adding C:\Program Files\Internet Explorer to the path fixed that. The mf*.dll files, though… that’s media related. Like, “Media Player” style. I’ve seen places that you can get that with WPF bits.

I made sure my build server had all the latest patches after dealing with the Visual C++ and IE stuff, and… then I got more failures. Stuff about “api-win-core-somethingorother.dll” and some WinRT(?!) stuff.

ARGH.

FxCop was added to the Visual Studio Express family, butthe blog article on itdoesn’t tell you which Visual Studio Express has it. Turns out the Visual Studio Express for Web does not include it.

Visual Studio Express for Windows Desktop has FxCop in it, so that’s what you have to install to get FxCop up and running. I presume the Express for Windows 8 version also has it, but I don’t know and I didn’t check. I’m kind of surprised the web one doesn’t come with FxCop.

So… there you go. You have to install Visual Studio on your build server if you want FxCop. (Or you have to chase down all the chained-in dependencies and drag them along with your local version, in which case, good luck with that.)

Note that, even with VS Express installed, I still failed with an error when running from the command line: Failed to add rule assembly: c:\program files (x86)\microsoft visual studio 11.0\team tools\static analysis tools\fxcop\Rules\DataflowRules.dll. Looking in the folder, sure enough, it’s missing. I don’t see anything referencing that assembly, but it’s there in a VS Premium installation, so… what gives?

In fact, there’s a lot missing from the Express version of FxCop that is there in Premium. Like… the whole Phoenix analysis engine is totally missing. What gives? Honestly, I ended up not only having to install VS Express, but also copy over the missing stuff into C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Static Analysis Tools\FxCop so I could get apples-to-apples builds on my build server and dev machines. (Alternatively, I guess you could install VS Premium on the build server since, hell, you’re already installing Visual Studio, so you lost that battle.)

In the end, I had to install Visual Studio 2012 Premium on the build server in order to get things working. Yeah, you read that right. I mean, if you already have two different Express SKUs installed and still didn’t get the entirety of FxCop, it’s time to stop messing about.

I can’t say this leaves me happy. I’m baffled as to why this doesn’t “just work.” FxCop is a standalone thing. It doesn’t make sense that you couldn’t just install it as part of the Windows SDK or a .NET SDK or something. Kind of makes me wonder if it’s an indirect sales ploy to get you to convert to TFS or something.

net, build comments edit

As part of some of my web projects I have “plugin assemblies” that aren’t directly referenced by the project but are things I want included in my deployment package. I tried following the instructions on this fairly popular blog entry, but it didn’t seem to work - that blog entry tells you to modify a set of files during a stage in the packaging pipeline “CopyAllFilesToSingleFolderForPackageDependsOn” and that target never actually fired for me. In fact, I threw an <Error> call in there just to see if I could get the build to fail and… no luck.

It also seems that manually copying the files over into the deployment staging/temporary folder stopped working - you can copy them over, but they instantly get deleted just before packaging occurs.

Turns out a lot of the way the MSDeploy packaging stuff in Microsoft.WebApplication.targets works changed in Visual Studio 2012 and… it’s like no one out there noticed. Or maybe everyone solved the problem and forgot to blog it. Or maybe I’m some special edge case. Anyway, it took some serious reverse-walkthrough of the packaging process to figure out what needs to happen. (Yeah, that was a day wasted.)

Now, instead of “CopyAllFilesToSingleFolderForPackageDependsOn” for the event to handle, use “PipelineCopyAllFilesToOneFolderForMsdeployDependsOn” for including your custom files. Once you do that, you don’t have to copy the files into the staging area or anything; the packaging process will do that for you.

Something else that changed - the “Package” target in Microsoft.WebApplication.targets seems to rely on the “Build” target in some cases. I tried setting the property so “Package” wouldn’t rely on “Build” (PipelineDependsOnBuild) but it always ended up doing some portion of “Build.” The problem there is that “Build“(from Microsoft.Common.targets) wants to run a target called “IntermediateClean” that deletes a bunch of stuff out of your bin folder - even assemblies that were built due to project references. (This happens more during a command line build than during a VS build. They’re treated differently… which is pretty annoying.) What this means is you have to “fool” the “IntermediateClean” during the packaging process so it doesn’t clean out your plugins. You do that by setting a “magic” item called FileWrites to contain all the stuff you want to keep.

Here’s a snippet from my web project .csproj file showing how I just include everything in the bin folder since I want all the copied-in dependencies to be kept for the packaging:

<PropertyGroup>
  <PipelineCopyAllFilesToOneFolderForMsdeployDependsOn>
    IncludePluginFilesForMsdeploy;
    $(PipelineCopyAllFilesToOneFolderForMsdeployDependsOn);
  </PipelineCopyAllFilesToOneFolderForMsdeployDependsOn>
</PropertyGroup>
<Target Name="IncludePluginFilesForMsdeploy">
  <ItemGroup>
    <FileWrites Include="$(MSBuildProjectDirectory)\bin\**\*" />
    <_CustomFiles Include="$(MSBuildProjectDirectory)\bin\**\*" />
    <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
      <DestinationRelativePath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
    </FilesForPackagingFromProject>
  </ItemGroup>
</Target>

That all has to go after the line that imports the Microsoft.WebApplication.targets file.

Every year, maybe every other year, Jenn and I head down to Las Vegas. There’s always something new to check out and it’s a fun place to visit.

This time we stayed at ARIA again since we enjoyed it so much last time. It’s a nice place with lots of great amenities, and we got a pretty good deal so off we went. (We left Phoenix with Grandma and Grandpa Illig.)

Normally we kind of do the same stuff – we run ourselves ragged walking up and down the strip trying to see every hotel and visit every shop. What we’ve found, though, is that while we tire ourselves out, there’s not that much changing (it changes fast, but not that fast) so we haven’t actually seen a lot of new stuff. This time we decided to make a point to both not walk our feet off and see new stuff we’d not seen before.

The first night we were there we hit the Fremont Street Experience. We had heard about it a lot, but hadn’t ever made it down there. It was well worth it – there was a lot to see. We rode the zip lines down the street, watched like three or four bands perform, and found where they hid the $5 blackjack tables (the Golden Gate). We don’t really gamble, but we had a lot of fun playing. (I think I rode $20 for like an hour. I lost, but I got my money’s worth.)

Travis riding the zip
line

Only downside to the Fremont Street thing is how far away it is from the strip. We took a taxi and it was like $25 each way (not counting tip). If you plan on checking that out, you either need to figure out public transportation, rent a car, or actually stay down there.

Another thing we did that I wanted to do since last time we were there was check out the Minus 5 ice bar. The whole place is a big freezer where the walls are lined with blocks of ice, the furniture is made of ice, and even the cups you drink out of are ice. It is, as you can imagine, totally freezing in there. Like, you get a parka and some gloves along with your admission, but even with that you start to go numb in your fingers and toes after a while. You have to set your drink down on a neoprene coaster, too, since the cup and the table are ice and your cup will fly right off like an air hockey puck. (We played with that for a while.) There are sculptures and things made out of ice to check out, and there was a cool little “living room setting” made out of ice where they had a fireplace (the “fire” was a decal frozen in the ice) and on the mantel were a bunch of books – all frozen in a block of ice. It was fun and pretty novel.

Jenn and Travis at Minus
5

We ate at a couple of new places (the Wicked Spoon buffet is a new favorite), and we visited some of the same stores, but for the most part, we otherwise just really took it easy. We actually did accomplish our goal – not walking our feet off and trying a bunch of new stuff. It was good to get home and sleep in my own bed… but I could stand to go back in a few months. I always have a good time.

Here’s the full photo album in case you’re interested. Lots of decorations all over for Chinese New Year.

net, vs comments edit

UPDATE 6/1/2013: As of June 1, 2013, the licensing has been updated so you can run all of your MSDN software except Windows client and Windows Server on Azure. This is outlined in the licensing whitepaper. I’ll leave the below discussion in place for posterity but the latest update has rendered it irrelevant.

I was sitting at the car repair place on Saturday with my Surface RT thinking it’d be nice to have a Visual Studio instance to tinker with. Given I have an MSDN subscription that comes with a free Azure VM and Visual Studio, it made sense to me that I could just set up the VM with Visual Studio and play on that.

It doesn’t look like licensing allows you to do that.

I’m still waiting to hear something somewhat “official” from Barry Dorrans (@blowdart) but Mark Brown (@markjbrown, an Azure community person) says you can’t do that, and my research agrees with Mark. Here’s what I’ve put together:

The Azure licensing FAQ says you can’t install Windows 7 or Office in Azure because they’re classified as “Desktop Applications” and can’t run on virtual machines. There’s also a question about running MSDN licensed items in the cloud indicating you can’t extend your rights there. I’ll copy/paste those here:

Q: Can customers run Microsoft Office and Windows 7 Client on Virtual Machines? A: No.  Under the Microsoft Product Usage Rights (PUR), Office and Windows 7 are not licensed to run on Virtual Machines.  In particular, Microsoft Office is classified in the PUR as “Desktop Applications”, which is not included in Licensing Mobility.

More information is available at the site for Microsoft Product Use Rights.

Q: Can a customer extend their MSDN use rights to the cloud? A: No, the software licensed under MSDN subscriptions is not for use in cloud environments.  However, most MSDN subscribers are entitled to a significant amount of Windows Azure services as a benefit of their subscription and can use these benefits to run instances of Windows Server on the Windows Azure IaaS or to run Windows Azure PaaS services.  For details on the amount of Windows Azure services included with MSDN subscriptions, please see http://www.windowsazure.com/en-us/pricing/member-offers/msdn-benefits/.

To run a VM including Microsoft server software such as SharePoint Server, Exchange Server, SQL Server, or BizTalk Server in a Windows Azure VM, an MSDN subscriber could use their Windows Azure benefits to cover the usage of the Windows Azure services and Windows Server running in the VM, then use license mobility on server licenses that their organization has covered under Software Assurance in order to run instances of the server software in the VM.

Following that Product Use Rights link, you can get the latest product list document and you’ll see that Visual Studio is also classified as a “Desktop Application,” so I have to assume it’s considered in the same way Office and Windows 7 are.

UPDATE 2/20/2013: Looking at the Visual Studio 2012 and MSDN Licensing White Paper, there’s this section:

When Virtual Environments Require a Separate License

If a physical machine running one or more virtual machines is used entirely for development and test, then the operating system used on the physical host system can be MSDN software. However, if the physical machine or any of the VMs hosted on that physical system are used for other purposes, then both the operating system within the VM and the operating system for the physical host must be licensed separately. The same holds true for other software used on the system—for example, Microsoft SQL Server obtained as MSDN software can only be used to design, develop, test, and demonstrate your programs.

I can see how Azure is a cloudy (haha) area here because the physical hardware backing it is hosting multiple VMs - some are production sites, some are dev/test.

It also appears there is some discrepancy in interpretation of whether or not you can use Windows 7 on a VM. It looks like if you have certain licenses for it, you actually can run Windows 7 in a VM.

This makes me re-think whether or not you really can use Visual Studio in the cloud. I’m less certain than I was when I posted the original article

From a personal standpoint, if you can’t use VS in the cloud… I think that’s dumb. From a business standpoint, if a company wanted to pay for Azure VM resources to host all of their dev machines or something in the cloud so you can stamp them out easily, scale up or down… why not? Sounds like a missed opportunity to me. But even if you ignore that, I feel like Visual Studio should be a kind of “special case” app. Yeah, it’s a desktop app, but there are different reasons you’d want to install it in places like Azure so I don’t know why you’d restrict it. Maybe they’ll change it in the future. Maybe they’ll extend MSDN licensing to allow for that special case or something. I hope they do. Until then… looks like I don’t get to dev on my Surface RT unless I want to set up the hosting for that myself… on a real, physical machine.

Standard disclaimers apply here. Doubly so because we’re in legal territory. I’m no lawyer, and I don’t know if you or your company negotiated different licensing. I don’t know about all the different crazy combinations of licensing out there and there’s a lot of craziness around licensing you need to be aware of to be fully compliant. For me, I’d recommend erring on the side of caution - if you don’t know for sure, don’t do it. Check with your Microsoft rep or company or whatever to find out for sure. I’m just providing the above research to show you what I found and maybe help inform you. If it turns out I’m wrong… let me know (and provide some docs I can refer to). I’ll be happy to update the article.

javascript, sublime comments edit

I’ve got Sublime Text 2 and I love it. (I even have a package I wrote myself for it.)

I wanted to get JSHint going in it and I saw that there was a nice JSHint package… but then I found SublimeLinter, which seems to be the King of Sublime Text Linting Packages. It basically can run any lint for any program type and gives a nice inline highlighting for errors. Very cool, very flexible.

And very hard to figure out all the steps needed to get JSHint up and running properly on a clean system. So here’s what you do:

  1. If you don’t already have it,****install node.js**.** JSHint comes packaged with SublimeLinter and uses node.js to run it.
  2. If you haven’t already done it,**install Package Control for Sublime Text. Restart Sublime Text after you do that.
  3. Open the Sublime Text command palette (Tools –> Command Palette) and type “Install Package” in the palette to get the Package Control install dialog.
  4. Type “SublimeLinter” in the package list to find the SublimeLinter package.Install that.
  5. Restart Sublime Text. This isn’t always strictly necessary, but sometimes (like when installing node.js) stuff in the environment changes and you need Sublime Text to refresh that.
  6. Optional: Set your JSHint user options by going to Preferences –> Package Settings –> SublimeLinter –> Settings - User. It’s a blank file, so you may want to look at the default settings to get a copy/paste start.

Now when you open a JavaScript file, you’ll see highlighting on lines with problems. JSHint runs in the background and updates the highlighting with problem lines. To figure out the problem, put your cursor on the line and look in the status bar at the bottom of Sublime Text.

Sublime Linter

For JSHint options, I’m using the same ones as jQuery. My user SublimeLinter.sublime-settings is below.

    {
        "jshint_options":
        {
            "curly": true,
            "expr": true,
            "newcap": false,
            "quotmark": "double",
            "regexdash": true,
            "trailing": true,
            "undef": true,
            "unused": true,
            "maxerr": 100,

            "eqnull": true,
            "evil": true,
            "sub": true,

            "browser": true,
            "wsh": true,

            "predef": [
                "define",
                "jQuery"
            ]
        }
    }