Nant: Error loading GUID of project

I converted an old VS2003 project into VS2005 and tried to build it with an existing Nant build script. Nant started to fail with a following error: Error loading GUID of project...

        NAnt 0.85 (Build 0.85.2470.0; nightly; 10/6/2006)
        Copyright (C) 2001-2006 Gerry Shaw
        http://nant.sourceforge.net

        Buildfile: file:///C:/projects/MyProject.build
        Target framework: Microsoft .NET Framework 2.0
        Target(s) specified: Build 

                [echo] Using 'net-2.0' framework on 'win32' platform.

        Build:

        BuildProjects:

             [echo] Current base directory: .
             [echo] Building all projects under base directory...
         [solution] Starting solution build.

        BUILD FAILED - 0 non-fatal error(s), 1 warning(s)

        Error loading GUID of project 'C:\projects\MyProject\MiddleTier\DBAccess.csproj'.
            Couldn't locate ProjectGuid in project 'C:\projects\MyProject\MiddleTier\DBAccess.csproj'

        Total time: 0.8 seconds.

My build file as below was working before I converted the project using VS2005.

        <target name="Build">
          ...
            <solution configuration="${configuration}">
                <projects basedir="${basedir}">
                    <include name="**\*.csproj"/>
                </projects>
            </solution>
        </target>

After digging into the Nant online doc, I found that the current version of Nant doesn't support VS2005 project . Visual Studio 2005 uses the MSBuild project file to store build information about managed projects. Project settings added and changed through Visual Studio are reflected in the .*proj file that is generated for each project. Visual Studio uses a hosted instance of MSBuild to build managed projects, meaning that a managed project can be built in Visual Studio and from the command line (even without Visual Studio installed), with identical results. Thus the solution is use MSBuild to build VS2005 project file. I changed the Nant script as below:

        <target name="exec-msbuild">
            <exec program="msbuild"
                commandline='"${solution.file}" /v:q /nologo /t:${solution.target} /p:Configuration=${configuration}' />
        </target>

Now my project successfully migrated to VS2005 and .Net 2.0.

See also

  • SQL: Use Dynamic SQL Query Correctly
  • SQL 2005: Use DMV and CROSS APPLY to Get Cached Plans
  • SQL 2005: Discontinued or Deprecated Features in SQL Server 2005
  • SQL 2005: Default Trace Enabled Option
  • SQL 2005: Column Level Permissions
  • SQL 2005: SQLCMD Supports Parameterized Variables and Macro Features
  • SQL 2005: DTS Has Become SSIS now
  • SQL 2005: Microsoft SQL Server 2005 JDBC Driver
  • SQL 2005: Query Notifications in ADO.Net 2.0
  • SQL 2005: Overcome SQL Index Size Limit
  • SQL 2005: DDL Triggers
  • SQL 2005: Why Should Use 64 Bit Now
  • SQL 2005: How to Rebuild The Master Database
  • SQL 2005: A Little Trick to Install SQL 2005 Onto Your Dirty DEV Machine
  • SQL 2005: New Resource Database
  • SQL 2005: Alter Index Rebuild
  • SQL 2005: XQuery Sample
  • SQL 2005: How to Move Database
  • SQL: Use COALESCE to Generate a List
  • SQL: How to Debug SQL Deadlocks
  • .Net: How to Bypass Strong Name Check
  • Agile: Lean Software Development - An Agile Toolkit
  • ORM: How to Use nHibernate 1.2 to Call Stored Procedure to Return a Dataset Without a Mapping Entity
  • AJAX: ASP.NET AJAX Tips
  • .Net: Debugging Commands
  • .Net: How to Run NUnit And Debug Your Test Fixtures Directly from VS 2005
  • .Net: How to Add Domain User to Local Group
  • .Net: Lock Value Type?
  • .Net: How to Create an Instance of a Generic Type with Parameters
  • .Net: How to Get Address of a Managed Type
  • ORM: New Features of nHibernate 1.2
  • .Net: How to Get System Error Message from HRESULT in Managed Code
  • .Net: Use Windows PowerShell Now
  • WMI: Use WMI to Run Commands on Remote Machine
  • API: GetLogicalProcessorInformation to Detect CPUs
  • .Net: How to Implement Singleton Correctly
  • .Net: There is no MTS object context (Exception from HRESULT: 0x8004E004)
  • .Net: The Net Objectives Pattern Repository
  • Web: Access Denied When ASP.Net Accesses Eventlog
  • Nant: Error Loading GUID of Project
  • AJAX: Ajax in Action
  • DTC: DtcGetTransactionManager Fails
  • .Net: Run .Net 1.1 COM+ Serviced Components Under .Net 2.0 Framework
  • .Net: Debugging Managed Code Tip
  • .Net: Assembly Binding Log Viewer (Fuslogvw.exe)
  • .Net: .Net Framework Design Guidelines
  • .Net: Use Global Catalog and CheckTokenMembership to Check AD Group Membership



  • THIS POST IS PROVIDED "AS-IS" WITH NO WARRANTIES AND CONFERS NO RIGHTS. Build time: Sun 03/30/2008 . ©2007 Dalun Software. All rights reserved. Back to Article List