There are two names for the application that you are publishing, the productName and the publishName (publishName/AssemblyName I think they are the same). Both of which you can specify in your .csproj file.
I want to set both of these without changing the .csproj file using MSBuild's command line parameters. So far I have used this page from msdn and figured out how to change the product name.
MSBuild.exe /t:Build /p:ProductName=$productName.
How can I change the publishName in a similar fashion?
When I say publishName I mean the file that gets created with the .application extension. Anyone know what property I need for this - /p:*?
I have also checked out a Stack Overflow page and tried all of the suggestions there but they didn't work.
To solve this, I added my own variable in the .csproj file to control the name of the .exe (without affecting the name of the subproject builds):
<!-- Make the assembly name configurable -->
<AssemblyName Condition=" '$(MSBuildAssemblyName)' == '' ">MyDefaultAssemblyName</AssemblyName>
<AssemblyName Condition=" '$(MSBuildAssemblyName)' != '' ">$(MSBuildAssemblyName)</AssemblyName>
if MSBuildAssemblyName is not specified on the command line, it uses the default name (MyDefaultAssemblyName).
On the command line, invoke it like this: msbuild ... /p:MSBuildAssemblyName=MyOverriddenName ...
Don't include the quotation marks!
MSBuild.exe /t:Build /p:ProductName=$productName;AssemblyName=yourNameHere
Also, this won't work if you have another project in the same solution - both will get the same assembly name!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With