25

Where can I find the W3C XML Schema (XSD) for a .csproj file, for Visual Studio 2008?

It seems like this should be obvious, but I spent some time and haven't found one.

I looked in %VS2008%\xml\Schemas, no joy. no joy searching the 'tubes either.

Cheeso
  • 184,848
  • 97
  • 460
  • 704

5 Answers5

21

The csproj files are in fact MSBuild files. The xsd for those can be found here:

%windir%\Microsoft.NET\Framework\[framework version]\Microsoft.Build.xsd
Fredrik Mörk
  • 151,624
  • 28
  • 285
  • 338
9

The easiest way to figure this out is to unload that project in Visual Studio, then right-click and edit the csproj file.

  1. Open the Visual Studio Solution
  2. Unload one of the projects
  3. Right-click on the unloaded project in the "Solution Explorer" pane
  4. Click "Edit PROJECT_NAME.csproj"
  5. Open the "Properties" pane in Visual Studio
  6. Click anywhere inside the editor pane for the .csproj file
  7. The "Properties" pane should update with different information
  8. Look in the "Schemas" for a list of schemas that apply to that .csproj file

I tried this in Visual Studio 2013, but this should apply to multiple versions of Visual Studio, since at this point the .csproj file is treated like any other XML file.

Greg Burghardt
  • 16,381
  • 7
  • 46
  • 83
8

I was able to find it in %VS2008%\Xml\Schemas\1033\MSBuild\Microsoft.Build.Core.xsd. The target namespace matches the project files' namespace, and the structure looks right.

Welbog
  • 57,620
  • 8
  • 112
  • 120
  • 1
    Still applies to the xsd schemas for visual studio 2010 csproj files. – bwerks Feb 11 '11 at 19:14
  • 1
    Applies to VS2012 too! `Reference` XML tag (it's a sibling of `ItemGroup`) can be found in `Microsoft.Build.Commontypes.xsd` in the same folder. – Csaba Toth May 21 '13 at 22:33
  • Location suggested by @Fredrik Mörk is also good. .NET 4.0 contains the xsds of VS2012. .NET 3.5 and 2.0's xsds in MSBuild directory are significantly smaller than .NET 4's. – Csaba Toth May 21 '13 at 22:36
3

The csproj files are MSBuild files so you should use the schema for MSBuild which is in:

%VS2008%\Xml\Schemas\1033\MSBuild\Microsoft.Build.Core.xsd
Pervez Choudhury
  • 2,812
  • 3
  • 26
  • 27
1

msbuild v14 is now:

C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild
RAY
  • 2,039
  • 2
  • 17
  • 16