As I told you offline : right now, its not possible to create assemblies
containing no source files at all using the commandline compilers.
HJowever, I'm pretty sure MS will have to revise this if they intend
want to
use MSBuild as build engine in VS.NET Whidbey.

We can't just have the <solution> task skip the project if there are no
sources in the project, as there could, for example, be resources in the
project.
>>> Hi Gert/Jeffrey,

Turns out we run into the same issue with MSBuild.  The compilers have
very good reasons for erroring in this case, so they will not be
changing in the Whidbey timeframe.  We have gotten around this problem
in our targets files.  I've pasted the steps below.  This ports pretty
1:1 to NAnt so you should be able to do the same to get around this
problem.

Basically we create an empty file which we then feed to the compilers.
We use our touch task to do this for us.  We then clean this file.  

In the beta of Whidbey if you look in our Framework.targets you'll find
the following target:

<!--
 Prepare the prerequisites for building.
-->
<Target
  Name="PrepareForBuild"
  DependsOnTargets="$(PrepareForBuildDependsOn)"
>
  <!--
    Create the directories for intermediate and final build products.
  -->
  <MakeDir
     Directories="$(OutDir);$(IntermediateOutputPath);
                  @(DocFileItem->'%(RelativeDir)')"/>
  <!--
    We support building libraries even when there are no source files.
    If no source file is specified in the project file, then we generate
    an empty one here with an extension of     
    $(DefaultLanguageSourceExtension).
  -->
  <Touch
     Condition="'@(Compile)'==''"
     AlwaysCreate="true"
     Files="$(IntermediateOutputPath)VisualStudio.Empty
            $(DefaultLanguageSourceExtension)">
     <Output TaskParameter="TouchedFiles" ItemName="Compile" 
             Condition=" '$(BuildingInsideVisualStudio)' != 'true' "/>
  </Touch>
</Target>
  
<!--
 Delete the empty source file if one was created at the start of the
build.
-->
<Target
  Name="RemoveEmptyGeneratedSource"
  Condition="Exists('$(IntermediateOutputPath)VisualStudio.Empty
             $(DefaultLanguageSourceExtension)')"
  DependsOnTargets="$(RemoveEmptyGeneratedSourceDependsOn)"
>
    <Delete Files="$(IntermediateOutputPath)VisualStudio.Empty
                   $(DefaultLanguageSourceExtension)"/>
</Target>

Let me know if you have any other questions,

Alex Kipman ([EMAIL PROTECTED])
Program Manager
MSBuild Team

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gert
Driesen
Sent: Friday, March 05, 2004 6:18 AM
To: Keyser, Jeffrey; [EMAIL PROTECTED]
Subject: Re: [nant-dev] Bug #908317 - Project with no source files
builds with an error


> ----- Original Message ----- 
> From: "Keyser, Jeffrey" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, March 03, 2004 9:04 PM
> Subject: [nant-dev] Bug #908317 - Project with no source files builds
with
an error
>

> Gert,
>
> I'm answering your question in the mailing list rather than the bug
> itself because I think my answer may prompt a larger discussion.
First,
> let me describe our situation -
>
> We have a VS.NET solution that was created before I started here.  One
> of the projects is a documentation-only project that contains only
Word
> and other documents.  Since VS.NET doesn't have a generic project
type,
> the developers created a VB.NET library project and added the
documents
> to that.  They also marked that project to not be built by the
solution.
> When we run the NAnt solution task on our solution, it fails on this
> project.

As I told you offline : right now, its not possible to create assemblies
containing no source files at all using the commandline compilers.
HJowever, I'm pretty sure MS will have to revise this if they intend
want to
use MSBuild as build engine in VS.NET Whidbey.

We can't just have the <solution> task skip the project if there are no
sources in the project, as there could, for example, be resources in the
project.

>
> To answer your question, "is this really a big issue?"  Ultimately,
> since building our solution with VS.NET doesn't fail, we want the
> solution task to not fail as well.  However, my proposed fix is not
the
> only options, though the other option I can think of appears to be
more
> painful, though cleaner in my mind.
>
> Option #2 - change the solution task to use solution configurations
> instead of project configurations.  In other words, have the task look
> at the solution configuration with the name in the "configuration"
> attribute, determine which projects should be build for that
> configuration and the configuration to use for each individual
project.
> Since our "documentation" project is marked to not be built, it would
> skip this one and the build would not fail.

I added support for this to cvs (and the latest nightly build).

Let me know if it works for you and if this means I can close bug report
#908317 ...

Gert



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to