コンパイル時に*.sln
ファイルを呼び出すmsbuildがあります。このソリューションファイルには10個のcsprojectが含まれており、そのうちの1つ(main.csproject
と呼ぶ)のAssemblyName
はWinMusic
です。次のようにMSBuildのの内容は次のとおりです。msbuildを使用してcsprojectのAssemblyNameを変更します。
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Default value here -->
<DefineConstants Condition=" '$(DefineConstants)'==''" >TRACE</DefineConstants>
<SlnFiles Condition=" '$(SlnFiles)'==''" >FullProject.sln</SlnFiles>
</PropertyGroup>
<!-- <ItemGroup> -->
<!-- <SlnFiles Include="SlnFiles=$(SlnFiles2)"/> -->
<!-- </ItemGroup> -->
<Target Name="Build">
<MSBuild Projects="$(SlnFiles)"
Properties="DefineConstants=$(DefineConstants)"/>
</Target>
</Project>
私の質問は、上記のMSBuildタスクからAssemblyName
プロパティを設定する方法、ありますか?
明確にするために、私はAssemblyInfo.cs
ではなく、csprojectでAssemblyName
を話しています。
編集:これは私が試した新しいbuild.proj
ファイルであり、FullProject.sln
は1つのexeファイルと1つのDLLでのソリューションファイルですが、MSBuildのファイルがNoMusic
へのdllとexeファイルの両方の名前を変更しました。私が望むのは、exeファイルの名前をNoMusic
に変更するだけで、dllは同じ名前を保持する必要があります。
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Default value here -->
<DefineConstants Condition=" '$(DefineConstants)'==''" >TRACE</DefineConstants>
<SlnFiles Condition=" '$(SlnFiles)'==''" >FullProject.sln</SlnFiles>
</PropertyGroup>
<Target Name="Build">
<MSBuild Projects="$(SlnFiles)"
Properties="DefineConstants=$(DefineConstants)"/>
<MSBuild Projects="WindowsFormsApplication1\WindowsFormsApplication1.csproj"
Properties="DefineConstants=$(DefineConstants);Platform=ANYCPU;AssemblyName=NoMusic"/>
</Target>
</Project>
この方法では、プロジェクトのプロパティを 'msbuild.exe main.csproject.csproj/p:AssemblyName = NoMusic'と同様に再定義します。 '/ p'スイッチが何をしているのかわからない場合はMSBuildのドキュメントを見てください。 –
[こちら](http://social.msdn.microsoft.com/Forums/en/msbuild/thread/95a04398-05c1-4fea-b596-abbe156e6a84)は、MSBuildのプロパティ評価プロセスに関する広範な情報です。 –
@James、私はそれが動作するとは思わない;ソリューション内に2つのプロジェクト(1つのexe、別のdll)がある場合、dllとexeの両方がNoMusicに名前変更されます。これは明らかに私が望むものではありません。 – Graviton