I am developing a ClickOnce-deployed application and would like to split my releases into multiple builds (a "stable" release and a "test" release). I know that to keep my test and stable releases separate, I need to set the "AssemblyName" property to be different. Here is what my call to MSBuild looks like in my NAnt script:
<msbuild project="../MyProject/MyProject/MyProject.csproj" target="publish">
<property name="Configuration" value="Release"/>
<property name="ApplicationVersion" value="${buildnumber.version}"/>
<property name="ProductName" value="My Project (Test)"/>
<property name="AssemblyName" value="MyProjectTest"/>
<property name="InstallUrl" value="http://www.mycompany.com/software/MyProjectTest/"/>
</msbuild>
However, one of the references of my project is a library which I also wrote myself. The reference is therefore to the .csproj
file of the library instead of a DLL. The above MSBuild call seems to force the AssemblyName
recursively down, setting the AssemblyName
of my library project to also be "MyProjectTest", when I would like it to just be called "MyLibrary".
Here's a snippet from MyProject.csproj
(ie. MyProject's MSBuild script), showing the reference to the library:
<ItemGroup>
<ProjectReference Include="..\..\MyLibrary\MyLibrary\MyLibrary.csproj">
<Project>{A011B373-74D3-45EF-92E2-F342C572402A}</Project>
<Name>MyLibrary</Name>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
I have a few workarounds which might work, like building the library separately and then setting the reference to point to the compiled DLL instead of the .csproj
file, or manually copying-and-pasting the properly-compiled version of the library over from the stable release's folder, but what I would really like is for NAnt to work properly.
So, I suppose my question is this: Is there a way to force the AssemblyName
of just one project using NAnt's msbuild
task?
Edit: Another little note: Another fellow a few years ago had this same issue but never got a satisfactory solution. You can read the question (and relevant comment) here: Change AssemblyName of a csproject via msbuild