Archive for category Visual Studio

BlogEngine.NET project locks up

I like BlogEngine.NET for a blogging platform. It’s easy to set up and use, and it appeals to the programmer side of me (which is a very large chunk) because of its extensibility.

But I was having a problem. After I extracted the files from the ZIP file and used the solution once, I could never use the project again – the three projects inside of the BlogEngine.NET solution would say “Initializing…” and would never go beyond that, and Visual Studio would completely freeze.

I found that the Visual Studio Solution User Options file (the last one in the image below) was the problem. I deleted this file, and I was able to open the solution just fine.

BlogEngine.NET files

BlogEngine.NET files


Leave a comment

Path too long message when publishing from Visual Studio

While attempting to publish a web app from Visual Studio 2013 to Azure, I ran across this message:

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Searching the Internet provided many possible solutions, most involved modifying the MSBuild settings. None of them worked, unfortunately.

What did work, though, was moving the file to a shorter directory. So instead of hosting my project in C:\Users\scott.stoecker\Documents\Visual Studio 2013\Projects\ScottsApp folder, I moved it to C:\Projects, and that worked great.

1 Comment

“Package restore is disabled by default” in Visual Studio

While opening a solution that another developer (or ten) had worked on earlier, I came across this friendly NuGet error:

Package restore is disabled by default. To give consent, open the Visual Studio Options dialog, click on Package Manager node and check ‘Allow NuGet to download missing packages during build.’ You can also give consent by setting the environment variable ‘EnableNuGetPackageRestore’ to ‘true’.

As I delved into Tools -> Options – Package Manager to set the required setting, I saw that it was already set.

After some StackOverflowing, I saw that a workaround for this was to set an environment variable. To do this in Windows 8, I went to Control Panel – System – Advanced and clicked on the “Environment Variables” button. I added a new system variable called “EnableNuGetPackageRestore”, and set its value to “true”.

After doing this, it still didn’t work. I found that I needed to close and reopen Visual Studio in order for the change to take effect.

Leave a comment

No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’

This was the message I was getting while trying to run a unit test against my C# project:

No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’

Not pleasant. My web project did have Entity Framework 6.x installed, so what was going on?

The issue wasn’t with my web project, it was with my test project. I needed to have those Entity Framework DLLs in my test project as well. I took the easy way out and installed them via NuGet Console. At the prompt, I entered this:

Install-Package EntityFramework


Voila, that was all I needed. But just make sure that when the NuGet Console is open, you change the “Default project” drop down list to point to your test project, not the project with the code to be tested.

Leave a comment

Visual Studio DLL name, why won’t you change?

So I decided that my project name sucked, and I wanted to change it into something different. I went ahead and renamed all the references in my KimKardashian project to EngelbertHumperdink. Everything – class references, project and solution names – you name it, I changed. Yet when I build my project, I continued to see the KimKardashian.dll file in the bin directory.

So I had to think outside the normal “Replace All” paradigm, going for a win-win  and synergize with myself. What I came up was is a healthy disgust of office buzzwords. But what I also came up with that the csproj file was what I needed. I went into my EngelbertHumperdink.csproj file and found two elements, RootNamespace and AssemblyName, and they had my nemesis:



A quick name-change and rebuild and all was well. Long live Engelbert Humperdink!

Leave a comment

Connecting Visual Studio 2008 to TFS 2010

We have an environment that requires both Visual Studio 2008 and Visual Studio 2010. Our repository is in Team Foundation Server 2010, and that holds both 2008 and 2010 data.

VS 2010 was working fine, but I could not get VS 2008 to connect to TFS. Looking for a solution, I saw blogs that mentioned there should be a “Team” menu, and a “Connect to Team Foundation Server” option under the Tools menu, among other things. I didn’t have that. I had installed Team System 2010 Team Explorer, but it wasn’t working.

So I finally figured out (i.e. found an article) that I needed Visual Studio Team System 2008 Team Explorer to get it working.  Hopefully, I can save someone that “duh” moment by pointing it out.

Leave a comment

Error: Task failed because “sgen.exe” was not found

I was happily building my project when up popped this message:

Task failed because “sgen.exe” was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for “sgen.exe” in the “bin” subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A. You may be able to solve the problem by doing one of the following:  1) Install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5.  2) Install Visual Studio 2008.  3) Manually set the above registry key to the correct location.  4) Pass the correct location into the “ToolPath” parameter of the task.

I knew why I got it. Earlier in the day, I Had moved the files from the C:\Program Files\Microsoft SDKs\Windows folder to my D: drive to get rid of some pesky “you’re running out of space” messages.

So I opened RegEdit and changed the “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A” key to the right path and then rebuilt.

Same error.

The solution was easy. I just closed Visual Studio 2008 and reopened it, and my next rebuild worked.

Leave a comment