Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Wednesday, 24 October 2012

Visual Studio 2010 not opening CSS files

Recently I have had a problem where Visual Studio 2010 wouldn't open any CSS files. I can't say for sure if this started happening just after I installed SP1 as I don't tend to edit many CSS files.

The solution I found was to install the following extension.
Extension Manager -> Online Gallery
Search for: "Web Standards Update for Microsoft Visual Studio 2010 SP1"

This information I found on the social MSDN site here.

Wednesday, 11 April 2012

Profile not available in Web Application

Using the Web Application project, you are unable to use the intellisense on the Profile class. A workaround has been provided by Joe Wrobel in a post build task.
This post build task is called Web Profile Builder and can be download here.
The simple approach:
  1. Install the package.
  2. Add the following to your .csproj file
    <Import Project="$(MSBuildExtensionsPath)\WebProfileBuilder\WebProfileBuilder.targets" />
  3. Build project
Joe has a more details in his post on how to use the build task.

Thursday, 19 January 2012

Unknown server tag 'asp:ScriptManager'

Currently build a new portal using Ajax for asynchronous calls.  Had the following error:
Unknown server tag 'asp:ScriptManager'

This error has caused me a headache over the last few days.  I finally narrowed it down to a missing line in the web.config.

<pages>
  <controls>
    <add tagPrefix="asp" namespace="System.Web.UI" 
            assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </controls>
</pages>

Tuesday, 17 January 2012

SetSite failed for package [Visual Studio Class Designer Package]

When starting Visual Studio you get a pop up which contains the following error:
The package 'Visual Studio Class Designer package' has failed to load properly. GUID {DD1683A7-5A4C-4234-81B3-A4CC91DBEAC9}
Close Visual Studio.

Now start Visual Studio with devenv /log

Navigate to the log location, normally:
C:\Users\username\AppData\Roaming\Microsoft\VisualStudio\10.0\ActivityLog.xml
If this log contains the following entries:

<entry>
 <record>208</record>
 <time>2012/01/17 15:06:00.310</time>
 <type>Information</type>
 <source>VisualStudio</source>
 <description>Begin package load [Visual Studio Class Designer Package]</description>
 <guid>{DD1683A7-5A4C-4234-81B3-A4CC91DBEAC9}</guid>
</entry>
<entry>
 <record>209</record>
 <time>2012/01/17 15:06:00.412</time>
 <type>Error</type>
 <source>VisualStudio</source>
 <description>SetSite failed for package [Visual Studio Class Designer Package]</description>
 <guid>{DD1683A7-5A4C-4234-81B3-A4CC91DBEAC9}</guid>
 <hr>8000ffff - E_UNEXPECTED</hr>
 <errorinfo>Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))</errorinfo>
</entry>
<entry>
 <record>210</record>
 <time>2012/01/17 15:06:00.415</time>
 <type>Error</type>
 <source>VisualStudio</source>
 <description>End package load [Visual Studio Class Designer Package]</description>
 <guid>{DD1683A7-5A4C-4234-81B3-A4CC91DBEAC9}</guid>
 <hr>8000ffff - E_UNEXPECTED</hr>
 <errorinfo>Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))</errorinfo>
</entry>
Now start Visual Studio with devenv /ResetSettings

If this doesn't work, then repair or re-install Visual Studio.

Wednesday, 21 September 2011

Speeding up Visual Studio

Do you find that Visual Studio is not fast enough for you? There are several guides and options you can tweak to improve performance.

Improve your hardware
  • 4Gb of RAM
  • Dual or Quad core processor
  • Solid State Drive(SSD) hard drive and install Visual studio and project files to this disk.

If this is not possible, try to tweak you visual experience.  One of the more comprehensive guides I found on this is here:
Ultimate Guide to speed up Visual Studio

Thursday, 8 September 2011

Rogue VSMacro80 folder

I've just rebuilt my machine after a hard disk crash, so lost most of my Visual Studio settings. Since the rebuild I've noticed that a VSMacro80 folder is appearing in my projects folder.  Every time I deleted it, it always seemed to return.

The solution is to update your projects location path:
Visual Studio -> Tools -> Options -> Projects and Solutions

Ensure that the path ends in a trailing slash. e.g. c:\Projects\

Wednesday, 5 May 2010

Create build file from solution file

You can create a build file from your solution for use with MSBuild. Useful if you are using any automated build tools like TeamCity.

To do this, open up the "Visual Studio 2008 Command Prompt"
Navigate to the folder containing your solution file
Enter the following:

Set MSBuildEmitSolution = 1
msbuild solutionname.sln


Once complete you should see a file in the folder called solutionname.sln.proj which is now your build file. You can edit this build file as required. I tend to add pre build code to update AssemblyInfo.cs and post build code to fire off unit tests and to package up the final output.

Friday, 19 February 2010

Cannot load macro project error

After moving 'My Documents' folder to a different drive, I started getting an error when loading the macro's explorer window. The error was:

Cannot load macro project '' for the following reason:

'C:\Users\\Documents\Visual Studio 2008\Projects\VSMacros80\Samples\Samples.vsmacros' is an invalid or inaccessible macro project file

The problem is when you move your documents folder, this updates the environment variable %USERPROFILE%, but the macro's path for Visual Studio are stored in the registry.

Searching the registry I found the following two keys which had a 'path' value, referencing the C:\.

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\vsmacros\OtherProjects7\0
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\vsmacros\RecordingProject7


To solve, change the 'path' values in the above keys to your new location and restart Visual Studio.

Attach to multiple w3wp processes

This is an update to a previous post as I am now working on a project that can have up to 3 w3wp processes running.

I've changed the following lines:

Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, compName).Item("w3wp.exe")
proc2.Attach2(dbgeng)


with:
For Each proc2 As EnvDTE80.Process2 In dbg2.GetProcesses(trans, compName)
If proc2.Name.Contains("w3wp.exe") Then
proc2.Attach2(dbgeng)
End If
Next

Wednesday, 3 February 2010

Visual Studio and Spark

There is a great post about setting up file icons, Templates and syntax highlighting in Visual Studio for spark templates here:

3 Useful Visual Studio Tricks for Spark Templates

Thursday, 7 January 2010

Debug prompt in VS 2008

When trying to debug an application using VS2008 on Windows 7 64 bit, I keep getting the following prompt, which is quite annoying.

debug prompt
To disable the prompt, you need to edit the following registry key. Ensure that Visual Studio is not running whilst you change the registry.

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Debugger
Set DisableAttachSecurityWarning attribute value to 1.

Tuesday, 6 October 2009

Visual Studio 2008 SP1 crashes when switch to Design View

When switching to design view for an ascx control, Visual Studio would close without any warning. In the Application event log, is the error:

.NET Runtime version 2.0.50727.4016 - Fatal Execution Engine Error (72336028) (80131506)

With some reading aross similar problems I came across the following command line that seems to solve the problem by deleting the native images of managed assemblies.

The following command needs to be run from the Visual Studio 2008 command prompt.

ngen /delete *

Thursday, 3 September 2009

Broken .designer files

Occasionally I somehow manage to break the designer files, which eventually flag up errors like:

The name 'xxxx' does not exist in the current context.

To fix this, delete the .designer file then right click on the aspx or ascx and select 'Convert to Web Application' this will rebuild the designer file and include all the necessary references to controls.

Wednesday, 28 January 2009

ASP.NET MVC 1.0 Release Candidate Available

Microsoft have shipped the ASP.NET MVC 1.0 Release Candidate (RC). It's available to download from here. This is hopefully the last release before they ship the final release, which they are hoping to be next month.

The extensive release notes, all 26 pages detail the upgrade process from ASP.NET MVC Beta and includes all the details that have changed.

Tuesday, 2 December 2008

Visual Studio Gridlines

You can place vertical gridlines in to the text editor for Visual Studio. This is useful if you have strict coding standards involving line lengths.

Open the registry
[HKEY_CURRENT_USER]\Software\Microsoft\VisualStudio\9.0\Text Editor
Add a new string value and call it Guides
Add in the value RGB(191,205,219) 16, 80, where RGB is the colour, followed by up to 13 positions of the line. The above example is place a line after the 16th and 80th character.

Tuesday, 4 November 2008

Friday, 17 October 2008

Intellisense not working in Visual Studio 2008

My Visual Studio 2008 stopped showing me intellisense the other day, unless I pressed Ctrl + Space. This was quite annoying as it is something I have come to rely on. After checking through all the settings, I stumbled across the "Statement Completion" options in Options -> Text Editor -> All Lanugages, these had all been unchecked, by what or how I don't know. I have now reset these options and Intellisense has returned.

Thursday, 2 October 2008

Attach to w3wp worker process

As a web developer I often need to attach to the worker process. Wouldn't it be nice if I could use a simple keystroke rather than following the process of selecting Debug -> Attach to process -> Then selecting the w3wp.

The following post has a macro that will do this for you, I wont take the credit for this solution:
http://blog.lavablast.com/post/2008/01/Attach-to-Process-with-one-shortcut.aspx

The post also tells you how to bind a shortcut to the macro. This tip saves me time and frustration.

UPDATE:
When logging in with a domain account, you need to change the following:

Dim compName As String = WindowsIdentity.GetCurrent().Name
compName = compName.Substring(0, compName.IndexOf("\"))


to

Dim compName As String = My.Computer.Name