473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

csproj/vbproj definition available?

I'm developing an application that takes a csproj file as input (and
output).
I've searched for a definition or schema file for the csproj xml-file
to understand the possibilites and restrictions, but not found any...

Does anyone know if there is a "manual" for the csproj (and vbproj)
file?

Best regards
/Magnus

Mar 5 '06 #1
5 7025
Hello su*****@hotmail.com,

MSBuild has msbuild.xsd - it's schema for csproj files
I'm developing an application that takes a csproj file as input (and
output).
I've searched for a definition or schema file for the csproj xml-file
to understand the possibilites and restrictions, but not found any...
Does anyone know if there is a "manual" for the csproj (and vbproj)
file?

Best regards
/Magnus

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 5 '06 #2
Hi,

Where can I find that msbuild.xsd file?

/Magnus

Mar 7 '06 #3
Hello SunYour,

Should be in c:\Program Files\Microsoft Visual Studio 8\Xml\Schemas\
I can't see it in my home pc (mb because Pro version of VS), but it was on
my work pc (teamsuite)

S> Hi,
S>
S> Where can I find that msbuild.xsd file?
S>
S> /Magnus
S>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 7 '06 #4
Hello Michael,

Now i found it under C:\Program Files\Microsoft Visual Studio
8\Xml\Schemas\1033\MSBuild

Microsoft.Build.Core.xsd and
Microsoft.Build.Commontypes.xsd

The project files for 2003 and 2005 differs quite much.
The csproj for a 2003 project was easy to traverse with for example

//Fetch all resource (.resx) files in csproject file
XmlDocument xd = new XmlDocument();
xd.Load(projectFile);
XmlNodeList nlReferences =
xd.SelectNodes("VisualStudioProject/CSHARP/Files/Include/File[@DependentUpon
and @RelPath and contains(@RelPath,'.resx')]");

The same concept does not work with a .net 2005 csproj file.
It is not possible to load the csproj as an XmlDocument and use the
SelectNodes method.
I'm not sure it is because of the namespace attribute xmlns in the root
element:

<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
...
</Project>

In the documentation, the SelectNodes method must have have no name
space definied in the xml document, or a prefix must be defined like:
xmlns:msb="http://schemas.microsoft.com/developer/msbuild/2003" (see
the extra :msb prefix)
In Microsoft.Build.Core.xsd, the prefix msb is defined, but not in the
project file... strange.

Is there another way to read and update the csproj file perhaps?
New instance of the Microsoft.Build.Core.xsd as a dataset and then load
the csproj file into it. After update, write it out as xml back
again... what do you think, any ideas? (i'll give it a try...)

Best regards
/Magnus

Mar 10 '06 #5
Hello again...

I found the

ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref0/html/T_Microsoft_Build_BuildEngine_Project.htm

document very useful :-)

a Microsoft.Build.BuildEngine.Project class that "Represents a project
that can be built using MSBuild." and A Project represents an MSBuild
project. It is a container for items, properties and targets. It can
load project content from in-memory XML or from an XML file, and can
save to an XML file, preserving most whitespace and all XML comments."

I think that is all I need...

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Build.BuildEngine;

namespace ListItemAndPropertiesCS
{
class Program
{
static void Main(string[] args)
{
// SET THIS TO POINT TO THE RIGHT LOCATION
Engine.GlobalEngine.BinPath =
@"C:\Windows\Microsoft.NET\Framework\v2.0.xxxxx ";

// Create a new empty project
Project project = new Project();

// Load a project
project.Load(@"c:\temp\validate.proj");

Console.WriteLine("Project Properties");
Console.WriteLine("----------------------------------");

// Iterate through the various property groups and
subsequently
// through teh various properties
foreach (BuildPropertyGroup propertyGroup in
project.PropertyGroups)
{
foreach (BuildProperty prop in propertyGroup)
{
Console.WriteLine("{0}:{1}", prop.Name,
prop.Value);
}
}

Console.WriteLine();
Console.WriteLine("Project Items");
Console.WriteLine("----------------------------------");

// Iterate through the various itemgroups
// and subsequently through the items
foreach (BuildItemGroup itemGroup in project.ItemGroups)
{
foreach (BuildItem item in itemGroup)
{
Console.WriteLine("{0}:{1}", item.Name,
item.Include);
}
}
}
}
}
/Magnus

Mar 10 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Robert | last post by:
Ref. Windows 2000 proffessional 5.00.2195 Service pack 4 Internet explorer 6.0.2800.1106 Visual basic .NET Standard 2003 MSDN library for Visual Studio .NET 2003 Microsoft Data Access Component...
4
by: BuddyWork | last post by:
Hello, Does anyone know if the csproj extension is been used under Whidbey or if it uses MSBuild (proj) extension?
1
by: John Lee | last post by:
Hi, Here is my issue with VS.NET IDE project reference: I have a project (myproj.csproj) referencing a non-GACed strongly named assembly (comp.dll 2.0.1.0) with copy local = true; we also have...
2
by: Allan Cammish | last post by:
Dear All I have the source code for a component that I purchased and although the source code files are for VB.NET, there is no .SLN or .VBPROJ file included. I have seen this before with...
2
by: GW | last post by:
After the conversion and fixing some errs VS2005 threw, project ran OK. Opened xxx.vbproj file after the conversion to VS2005 from VS2003. Changed (usng wordpad) ../msbuild/2003 to 2005...
0
by: sunyour | last post by:
I'm developing an application that takes a csproj file as input (and output). I've searched for a definition or schema file for the csproj xml-file to understand the possibilites and restrictions,...
6
by: AdrianDev | last post by:
Hi, Is there a tool available for building .NET 1.1 VS 2003 projects from CSPROJ files? It appears that MSBuild.exe only works with NET 2.0 thanks,
4
by: Max2006 | last post by:
Hi, When I use Web Deployment Project to create a deployment image of my web site, It includes un-necessaty files such as *.csproj files. Can I disable the deployment of *.csproj files?
4
balabaster
by: balabaster | last post by:
If you modify a CSPROJ or VBProj's source XML to use the UsingTask tag in order to create a new template (for example to add auto-incrementing versioning to every project I create automatically). I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.