MSBuild on a C# Console Application

  • Thread starter Thread starter Shapper
  • Start date Start date
S

Shapper

Hello,

I am editing a project file of a C# Console Application and I have the
following:

<ItemGroup>
<Deploy Include="$(TargetDir)*.*" />
</ItemGroup>
<Target Name="AfterBuild">
<Copy SourceFiles="@(Deploy)" DestinationFolder="$(ProjectDir)..\..
\Deploy\Software" />
</Target>

Sometimes the following part just disappears:
<ItemGroup>
<Deploy Include="$(TargetDir)*.*" />
</ItemGroup>

I do get a warning on that code:

Warning 4 The element 'ItemGroup' in namespace 'http://
schemas.microsoft.com/developer/msbuild/2003' has invalid child
element 'Deploy' in namespace 'http://schemas.microsoft.com/developer/
msbuild/2003'. List of possible elements expected: 'Item, Reference,
COMReference, COMFileReference, Xdcmake, Bscmake, ClCompile,
ClInclude, Midl, ResourceCompile, PreLinkEvent, CustomBuildStep,
Manifest, ProjectConfiguration, NativeReference, ProjectReference,
Compile, EmbeddedResource, Content, Page, Resource,
ApplicationDefinition, None, BaseApplicationManifest, Folder, Import,
Service, WebReferences, WebReferenceUrl, FileAssociation,
BootstrapperFile, PublishFile, CodeAnalysisDependentAssemblyPaths,
CodeAnalysisDictionary, CodeAnalysisImport, Link, ResourceCompile,
PreBuildEvent, PostBuildEvent' in namespace 'http://
schemas.microsoft.com/developer/msbuild/2003'.

How can I solve this?

Thank You,
Miguel
 
I am editing a project file of a C# Console Application and I have the
following:

<ItemGroup>
<Deploy Include="$(TargetDir)*.*" />
</ItemGroup>
<Target Name="AfterBuild">
<Copy SourceFiles="@(Deploy)" DestinationFolder="$(ProjectDir)..\..
\Deploy\Software" />
</Target>

Sometimes the following part just disappears:
<ItemGroup>
<Deploy Include="$(TargetDir)*.*" />
</ItemGroup>

I do get a warning on that code:

Warning 4 The element 'ItemGroup' in namespace 'http://
schemas.microsoft.com/developer/msbuild/2003' has invalid child
element 'Deploy' in namespace 'http://schemas.microsoft.com/developer/
msbuild/2003'. List of possible elements expected: 'Item, Reference,
COMReference, COMFileReference, Xdcmake, Bscmake, ClCompile,
ClInclude, Midl, ResourceCompile, PreLinkEvent, CustomBuildStep,
Manifest, ProjectConfiguration, NativeReference, ProjectReference,
Compile, EmbeddedResource, Content, Page, Resource,
ApplicationDefinition, None, BaseApplicationManifest, Folder, Import,
Service, WebReferences, WebReferenceUrl, FileAssociation,
BootstrapperFile, PublishFile, CodeAnalysisDependentAssemblyPaths,
CodeAnalysisDictionary, CodeAnalysisImport, Link, ResourceCompile,
PreBuildEvent, PostBuildEvent' in namespace 'http://
schemas.microsoft.com/developer/msbuild/2003'.

How can I solve this?

Check the schema and see what is valid.

The error seems to indicate that the Deploy tag can not
be inside the ItemGroup tag.

Arne
 
Check the schema and see what is valid.

The error seems to indicate that the Deploy tag can not
be inside the ItemGroup tag.

Arne

Yes, but I followed this MSDN example (http://msdn.microsoft.com/en-us/
library/3e54c37h.aspx):

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

<ItemGroup>
<MySourceFiles Include="a.cs;b.cs;c.cs"/>
</ItemGroup>

<Target Name="CopyFiles">
<Copy
SourceFiles="@(MySourceFiles)"
DestinationFolder="c:\MyProject\Destination"
/>
</Target>

</Project>

That is why I don't understand what is wrong.

Thank You,
Miguel
 
Yes, but I followed this MSDN example (http://msdn.microsoft.com/en-us/library/3e54c37h.aspx):

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

<ItemGroup>
<MySourceFiles Include="a.cs;b.cs;c.cs"/>
</ItemGroup>

<Target Name="CopyFiles">
<Copy
SourceFiles="@(MySourceFiles)"
DestinationFolder="c:\MyProject\Destination"
/>
</Target>

</Project>

That is why I don't understand what is wrong.

According to that example

<ItemGroup>
<MySourceFiles .../>
</ItemGroup>

is valid.

That does not imply that:

<ItemGroup>
<Deploy .../>
</ItemGroup>

is valid.

Arne
 
Back
Top