Below is a task from my top-level, default build file.  This is what
every project uses if no project-specific build file is supplied.  You
may prefer something that is solution specific, in which case you can
just write out the <webmap> and <web> nodes as per the online
documentation.

This script uses a number of variables, which should make sense based on
their names and/or the documentation for the attributes to which they
are assigned.

The generic/dynamic execution depends upon the existence of a
solution-level file in Visual Studio that provides the URL and PATH
attribute values as pipe-delimited pairs.  For example, any solution
that contains web projects here has a solution-level file named
"webmap.config" that contains one line for each web project, looking
something like:

http://localhost/App/Project.csproj|Client\Project.csproj

Now, I am pretty sure that someone could build an XSL transformation for
the VS solution file that would dynamically create the equivalent of our
"webmap.config" file, but XSL isn't my strong-suit and this took me a
total of 20 minutes to figure out and implement.

Here's the task.

<!-- This target generates the build 
     with the requested configuration. -->
<target name="compile">
  <!-- This first write will replace any existing
       file and write the "header". -->
  <echo file="${solution.buildfile}" append="false">
    &lt;project name="${solution.name}" default="build"&gt;
    &lt;target name="build"&gt;
    &lt;solution solutionfile="${solution.location}" 
        outputdir="${output.location}\bin\${build.type}" 
        configuration="${build.type}"
  </echo>
  <!-- If there is no webmap.config file, then we must not have
       any web projects.  Just close out the <solution> node. -->
  <if test="${not file::exists(webmap.file)}">
    <echo file="${solution.buildfile}" append="true">/&gt;</echo>
  </if>
  <!-- If there is a webmap.config file, then we need to write out 
           the <webmap> and <web> nodes for the web projects. -->
  <if test="${file::exists(webmap.file) and
file::get-length(webmap.file) > 0}">
    <echo file="${solution.buildfile}" append="true">
      &gt;
      &lt;webmap&gt;
    </echo>
    <!-- Loop through the webmap.config file and create the <map> nodes.
-->
    <foreach item="Line" in="${webmap.file}" delim="|"
property="url,path">
      <echo file="${solution.buildfile}" append="true">
        &lt;map url="${url}" path="${ccnet.working.directory}\${path}"
/&gt;
      </echo>
    </foreach>
    <echo file="${solution.buildfile}" append="true">
      &lt;/webmap&gt;
      &lt;/solution&gt;
    </echo>
  </if>
  <echo file="${solution.buildfile}" append="true">
    &lt;/target&gt;
    &lt;/project&gt;
  </echo>
  <!-- Now we need to execute the build file we just created. -->
  <nant buildfile="${solution.buildfile}" />
</target>

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jain,
Manish (GE Consumer Finance, Contractor)
Sent: Tuesday, May 17, 2005 9:32 PM
To: nant-users@lists.sourceforge.net
Subject: [Nant-users] Cannot build web project with solution task
Importance: Low

Sounds stupid but I've never tried this before, I am switching from
devenv to solution task in my scripts, but I get following error - 

Cannot build web project 'http://localhost/A/A.csproj'.  Please use
<webmap> to map the given URL to a project-relative path, or specify
enablewebdav="true" on the <solution> task element to use WebDAV.


Solution contains - 1 web project and 2 class libraries, I am specifying
full physical path.
Do I need to include , webmap and include elements?

Solution Script is - 

<solution configuration="debug" solutionfile="${solutionfile}">
        <webmap url="http://localhost/AUEngineWS/AUEngineWS.csproj"; 
        
path="${basedir}\Source\${projectname}\AUEngineWS\AUEngineWS.csproj" />
<projects>
        <include name="..\AUEngine\AUEngine.csproj" />
        <include name="..\TimeSlicePathMgr\TimeSlicePathMgr.csproj" />
</projects> </solution>

Following is my solution file - 

Microsoft Visual Studio Solution File, Format Version 8.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AUEngineWS",
"http://localhost/AUEngineWS/AUEngineWS.csproj";,
"{53769E5D-5C52-47FE-A383-F91FDC0DF80F}"
        ProjectSection(ProjectDependencies) = postProject
        EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AUEngine",
"..\AUEngine\AUEngine.csproj", "{E44B1DFA-3535-4C4A-AE70-E30A4CC77D4F}"
        ProjectSection(ProjectDependencies) = postProject
        EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TimeSlicePathMgr",
"..\TimeSlicePathMgr\TimeSlicePathMgr.csproj",
"{15A92B7F-6BF5-4288-BEA5-30A310E466B9}"
        ProjectSection(ProjectDependencies) = postProject
        EndProjectSection
EndProject
Global
        GlobalSection(SourceCodeControl) = preSolution
                SccNumberOfProjects = 4
                SccLocalPath0 = .
                CanCheckoutShared = false
                SolutionUniqueID =
{1145C8D4-2CAF-4431-8B06-804BDBD91DC3}
                SccProjectUniqueName1 =
http://localhost/AUEngineWS/AUEngineWS.csproj
                SccLocalPath1 = .
                CanCheckoutShared = false
                SccProjectEnlistmentChoice1 = 2
                SccProjectUniqueName2 = ..\\AUEngine\\AUEngine.csproj
                SccProjectName2 =
\u0022$/Appl/AU\u0020ReWrite/AUEngine\u0022,\u0020WBMDAAAA
                SccLocalPath2 = ..\\AUEngine
                CanCheckoutShared = false
                SccProjectUniqueName3 =
..\\TimeSlicePathMgr\\TimeSlicePathMgr.csproj
                SccProjectName3 =
\u0022$/Appl/AU\u0020ReWrite/TimeSlicePathMgr\u0022,\u0020WHCGAAAA
                SccLocalPath3 = ..\\TimeSlicePathMgr
                CanCheckoutShared = false
        EndGlobalSection
        GlobalSection(SolutionConfiguration) = preSolution
                Debug = Debug
                Release = Release
        EndGlobalSection
        GlobalSection(ProjectConfiguration) = postSolution
                {53769E5D-5C52-47FE-A383-F91FDC0DF80F}.Debug.ActiveCfg =
Debug|.NET
                {53769E5D-5C52-47FE-A383-F91FDC0DF80F}.Debug.Build.0 =
Debug|.NET
                {53769E5D-5C52-47FE-A383-F91FDC0DF80F}.Release.ActiveCfg
= Release|.NET
                {53769E5D-5C52-47FE-A383-F91FDC0DF80F}.Release.Build.0 =
Release|.NET
                {E44B1DFA-3535-4C4A-AE70-E30A4CC77D4F}.Debug.ActiveCfg =
Debug|.NET
                {E44B1DFA-3535-4C4A-AE70-E30A4CC77D4F}.Debug.Build.0 =
Debug|.NET
                {E44B1DFA-3535-4C4A-AE70-E30A4CC77D4F}.Release.ActiveCfg
= Release|.NET
                {E44B1DFA-3535-4C4A-AE70-E30A4CC77D4F}.Release.Build.0 =
Release|.NET
                {15A92B7F-6BF5-4288-BEA5-30A310E466B9}.Debug.ActiveCfg =
Debug|.NET
                {15A92B7F-6BF5-4288-BEA5-30A310E466B9}.Debug.Build.0 =
Debug|.NET
                {15A92B7F-6BF5-4288-BEA5-30A310E466B9}.Release.ActiveCfg
= Release|.NET
                {15A92B7F-6BF5-4288-BEA5-30A310E466B9}.Release.Build.0 =
Release|.NET
        EndGlobalSection
        GlobalSection(ExtensibilityGlobals) = postSolution
        EndGlobalSection
        GlobalSection(ExtensibilityAddIns) = postSolution
        EndGlobalSection
EndGlobal


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be
the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&op=ick
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to