Monday, May 07, 2007

Editing a Visual Studio 2005 project file


[This is not really news, just wanted to publish it somewhere so I can refer to it]


So how do you do it then?


It is simple actually:




  • (If the project file is under a locking source control provider e.g. Microsoft SourceSafe, you probably want to check out the project file first, as Visual Studio isn't smart enough to do it for you when you edit the file directly.)

  • Right-click a project in the solution explorer

  • Choose "Unload project"

  • Right-click the same project, that now is grayed out and suffixed with (unavailable)

  • Choose "Edit <filename>"

  • Edit away ...

  • Right-click the project, still suffixed with (unavailable)

  • Choose "Reload project"


There you go!


Caveat: This doesn't work under the Express versions of Visual Studio. That is, the "Unload Project" menu item is absent, you can still use the editor with schema support.




Technorati : ,

Thursday, May 03, 2007

Where's the QA when you need them?

Where is the QA when you need them? See the following image for clarification:




It listens to the name of ASUS ACPI Cneter (sic!) ... Product version 1.0.0.0, File version 0.1.0.24


It makes me wonder how something like this have slipped through?

Wednesday, May 02, 2007

Visual Studio dependencies


I figured I'd walk through the details on how to find out dependencies of a Visual Studio solution/project. (For those who haven't figured it out yet, this is a description how Dependency Visualizer does it)


1) For MSBuild compatible project types, it's dead simple, just use the following XPaths, where msbuild stands for the MSBuild schema: http://schemas.microsoft.com/developer/msbuild/2003


Assembly references: /msbuild:Project/msbuild:ItemGroup/msbuild:Reference/@Include


Project references: /msbuild:Project/msbuild:ItemGroup/msbuild:ProjectReference/msbuild:Project/text() returns a relative path to the project file.


2) There are project types that aren't MSBuild compatible (most notably C++ ones), and due to popular demand, I had to add support for these also to Dependency Visualizer.


Assembly references are simple: /VisualStudioProject/References/AssemblyReference/@AssemblyName


Project references: Here is where it starts getting nasty..


/VisualStudioProject/References/ProjectReference/@ReferencedProjectIdentifier gives... you guessed it, a GUID identifying the referenced project. This means we have to parse the freeish text format of the solution file, to find out what project hides behind the GUID. But it gets uglier still, turns out that there's actually dependencies and dependencies. If you go to "Project Dependencies..." window (in VC++) and check a project, then you end up with a reference that's only existing in the solution file like so:



Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProjectName",
"ProjectName\ProjectName.vcproj", "{769945FD-50DC-49E4-B93E-54250D7BF541}"
ProjectSection(ProjectDependencies) = postProject
{A4583937-88F4-4C1D-B5A9-E711C3951E3A} = {A4583937-88F4-4C1D-B5A9-E711C3951E3A}
EndProjectSection
EndProject

Where the GUID:s fit together like so: the first one is the type, the one on the second row is the project identifier, the thwo on the fourth row is the identifier of the referenced project.








Technorati : , ,

Tuesday, April 24, 2007

Adobe Reader on Vista Ultimate x64

After a lot of work and googling I finally managed to get Adobe Reader to install. The funny thing is that Adobe says that version 8 is Vista compatible. I'd like to question that, at least regarding the installer..

Downloaded

Adobe Reader 8 for Windows Vista

Started the installer, got the downloaded file warning but not the UAC dialog, then... absolutely nothing happened.

Then I tried "Run as administrator", still the same... absolutely nothing happened.

Googled around and found indication that running in XP SP2 compatibility mode might help. It did..

But come on Adobe, get your act together and produce an installer that Joe Average can use without extra fuzzing about!

Tuesday, April 03, 2007

Somasegar's WebLog : Listening to your feedback - Expression and MSDN

It seems a miracle has happened. Microsoft revaluated their decision about not including Expression Blend in MSDN subscription. Now it seems both Web and Blend (after its release) are included. Whoohoo! 

Link to Somasegar's WebLog : Listening to your feedback - Expression and MSDN

Simple properties

What do you prefer?

1)

private int m_foo;
public int Foo
{
get { return m_foo; }
set { m_foo = value; }
}

2)
public int Foo { get; set; }

3)
public:
property
int Foo;


The first is C#, the second C# 3.0 and the third one is C++/CLI

Monday, April 02, 2007

Nullable in C++/CLI

I was recently working on a C++/CLI project (which I only rarely do, as you'll soon find out)where there was a need to have a method returning a nullable DateTime.

I look up Nullable in the help, I see "ref class Nullable", think that the following will do it.

Nullable<DateTime>^ GetStuff();

I implement the thing and am a happy camper until I try to use it from a C# project. The intellisense says ValueType GetStuff(), WTF !?!

I take a look once again and find out that Nullable<T> is "public value class", so the correct incantation should have been:

Nullable<DateTime> GetStuff();

oh, and to return a null value you just do:

return Nullable<DateTime>();

(Anyone else finds the C# ? syntax for nullable types more easily digested?)