Вы должны создать новую конфигурацию (Debug and Release - по умолчанию), и в этой новой конфигурации вы не создали бы построенную .csproj.
Затем вы будете строить эту конфигурацию.
См:
Does Msbuild recognise any build configurations other than DEBUG|RELEASE
APPEND
БЕЗ делать новый/пользовательские конфигурации, это единственное решение, которое я могу рассуждать.
Помещенный ниже в файле под названием "MyBuild.proj" и называют
msbuild.exe MyBuild.proj
..
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="AllTargetsWrapped">
<PropertyGroup>
<WorkingDirectory>.</WorkingDirectory>
</PropertyGroup>
<Target Name="AllTargetsWrapped">
<CallTarget Targets="ShowReservedProperties" />
<CallTarget Targets="BuildOtherProjects" />
</Target>
<Target Name="BuildOtherProjects">
<ItemGroup>
<ProjectReferencesExcludes Include="$(WorkingDirectory)\UnitTests.csproj" />
<ProjectReferencesExcludes Include="$(WorkingDirectory)\SomeOtherProject.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReferences Include="$(WorkingDirectory)\**\*.*proj" Exclude="@(ProjectReferencesExcludes)" />
</ItemGroup>
<Message Text="List of projs to be built:"/>
<Message Text="@(ProjectReferences->'"%(fullpath)"' , '%0D%0A')"/>
<Message Text=" "/>
<Message Text=" "/>
<MSBuild
Projects="@(ProjectReferences)"
Targets="Build">
<Output
TaskParameter="TargetOutputs"
ItemName="AssembliesBuiltByChildProjects" />
</MSBuild>
<Message Text=" "/>
<Message Text=" "/>
<Message Text="List of AssembliesBuiltByChildProjects:"/>
<Message Text="@(AssembliesBuiltByChildProjects->'"%(fullpath)"' , '%0D%0A')"/>
<Message Text=" "/>
<Message Text=" "/>
</Target>
<Target Name="ShowReservedProperties">
<Message Text="MSBuild: $(MSBuild)"/>
<Message Text="MSBuildBinPath: $(MSBuildBinPath)"/>
<Message Text="MSBuildExtensionsPath: $(MSBuildExtensionsPath)"/>
<Message Text="MSBuildExtensionsPath32: $(MSBuildExtensionsPath32)"/>
<Message Text="MSBuildExtensionsPath64: $(MSBuildExtensionsPath64)"/>
<Message Text="MSBuildLastTaskResult: $(MSBuildLastTaskResult)"/>
<Message Text="MSBuildNodeCount: $(MSBuildNodeCount)"/>
<Message Text="MSBuildOverrideTasksPath: $(MSBuildOverrideTasksPath)"/>
<Message Text="MSBuildProgramFiles32: $(MSBuildProgramFiles32)"/>
<Message Text="MSBuildProjectDefaultTargets: $(MSBuildProjectDefaultTargets)"/>
<Message Text="MSBuildProjectDirectory: $(MSBuildProjectDirectory)"/>
<Message Text="MSBuildProjectDirectoryNoRoot: $(MSBuildProjectDirectoryNoRoot)"/>
<Message Text="MSBuildProjectExtension: $(MSBuildProjectExtension)"/>
<Message Text="MSBuildProjectFile: $(MSBuildProjectFile)"/>
<Message Text="MSBuildProjectFullPath: $(MSBuildProjectFullPath)"/>
<Message Text="MSBuildProjectName: $(MSBuildProjectName)"/>
<Message Text="MSBuildStartupDirectory: $(MSBuildStartupDirectory)"/>
<Message Text="MSBuildThisFile: $(MSBuildThisFile)"/>
<Message Text="MSBuildThisFileDirectory: $(MSBuildThisFileDirectory)"/>
<Message Text="MSBuildThisFileDirectoryNoRoot: $(MSBuildThisFileDirectoryNoRoot)"/>
<Message Text="MSBuildThisFileExtension: $(MSBuildThisFileExtension)"/>
<Message Text="MSBuildThisFileFullPath: $(MSBuildThisFileFullPath)"/>
<Message Text="MSBuildThisFileName: $(MSBuildThisFileName)"/>
<Message Text="MSBuildToolsPath: $(MSBuildToolsPath)"/>
<Message Text="MSBuildToolsVersion: $(MSBuildToolsVersion)"/>
</Target>
</Project>
Примечание, что если вы поставите csproj в списке, но другой Исключено csproj ссылки/зависят от него, он будет построен (независимо от того, что вы «исключаете»).
Почему вы не хотите строить этот проект? –
, потому что команда build i m targeting предполагает создание proj без единичных тестовых примеров. – prashanthkr08