Из Visual Studio я могу успешно скомпилировать код, но когда я пытаюсь скомпилировать код с использованием MSBuild, он выдает ошибку, как показано ниже
MSB4067: элемент <#text> нижеЭлемент Target не распознан.
Обратите внимание: я строю код, используя MSBuild в режиме выпуска, код, который я добавил для AfterTarget, предназначен только для режима отладки.
Если я удаляюкод, т.е. чем он работает нормально.
Вот мой файл csproj
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B9B35177-B239-41A9-946F-3BB1CC14BD3B}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ABC.MyProject.Engine</RootNamespace>
<AssemblyName>ABC.MyProject.Engine</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="ABCDataAccess, Version=2017.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\internal\ABCDataAccess.dll</HintPath>
</Reference>
<Reference Include="ABCNotifier, Version=2016.2.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\internal\ABCNotifier.dll</HintPath>
</Reference>
<Reference Include="ABCScheduler, Version=2016.2.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\internal\ABCScheduler.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\lib\thirdparty\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="core.cs" />
<Compile Include="Model\FileInstance.cs" />
<Compile Include="Model\FileLifeCycle.cs" />
<Compile Include="Model\StateExecutor.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Enterprise\Implementation\FileKarmaHandler.cs" />
<Compile Include="Enterprise\Implementation\FileKarma.cs" />
<Compile Include="Enterprise\Implementation\FileLifeCycleData.cs" />
<Compile Include="Enterprise\Interface\IFileLifeCycleData.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\ABC.MyProject.Core.csproj">
<Project>{E1B4DF28-23C5-4865-B7B7-51707D2116E3}</Project>
<Name>ABCCore</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Config\Archiver.xml" />
<Content Include="Config\ABClog.xml" />
<Content Include="Config\DataAccess.xml" />
<Content Include="Config\Notifier.xml" />
<Content Include="Config\Security.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
rmdir config
mkdir config
rmdir sqls
mkdir sqls
rmdir templates
mkdir templates
exit 0
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>
copy $(ProjectDir)Config\*.xml config\
copy $(ProjectDir)..\lib\thirdparty\*.* $(ProjectDir)\bin\$(Configuration)\
copy $(ProjectDir)..\Core\Config\*.xml config\
copy $(ProjectDir)..\Core\sqls\*.* sqls\
</PostBuildEvent>
</PropertyGroup>
<UsingTask TaskName="XmlPreprocess" AssemblyFile="..\lib\msbuild\lib\XmlPreprocess.MSBuildTasks.dll" />
<Target Name="AfterBuild" Condition="'$(Configuration)' == 'Debug' ">
<PropertyGroup>
<ConfigValuesSpreadsheetFileLocation>
..\lib\msbuild\config\Settings.xls
</ConfigValuesSpreadsheetFileLocation>
</PropertyGroup>
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="..\Core\Config\AlertParams.xml"
OutputFiles="bin\Debug\config\AlertParams.xml"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="..\Core\Config\CoreParams.xml"
OutputFiles="bin\Debug\config\CoreParams.xml"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="..\Core\Config\StateParams.xml"
OutputFiles="bin\Debug\config\StateParams.xml"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="Config\Archiver.xml"
OutputFiles="bin\Debug\config\Archiver.xml"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="Config\DataAccess.xml"
OutputFiles="bin\Debug\config\DataAccess.xml"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
<XmlPreprocess
ToolPath="..\lib\msbuild\lib\"
InputFiles="app.config"
OutputFiles="bin\Debug\app.config"
SpreadsheetFiles="$(ConfigValuesSpreadsheetFileLocation)"
Environment="$(Configuration)"
Clean="true"
Validate="true" />
</Target>
</Project>