Archive for category Visual Studio

Type or namespace name could not be found when building in Release mode

When building a web application with Visual Studio in Debug mode, I wasn’t getting any errors. But when I switched to Release mode, I received this error:

The type or namespace name ‘ScottStuff’ could not be found (are you missing a using directive or an assembly reference?)

There was no conditional logic to exclude that ScottStuff library based on the configuration I was using.

The problem was that when I made the reference to the ScottStuff DLL, I had included it from a different directory, c:\SomeDirectory\ScottStuff.dll. To fix the issue, I instead referenced the DLL from the bin folder of the project I was working on, c:\Projects\ScottProject\bin\ScottStuff.dll. After doing this, the project compiled successfully.


Leave a comment

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