2

So, here is what I am trying to do.

I am trying to stamp name of the user who compiled the particular project. As link assembly version is there any way by using that I can store the original user name on dll.

I tried creating custom attribute and using it in AssemblyInfo.cs, but it gives me the username of person who is running the dll and not who build it.

Any help will be appreciated.

3 Answers3

3

For modifying the Assembly info I use a pre-build event that executes a batch file for the modification.

Avi Turner
  • 10,234
  • 7
  • 48
  • 75
  • I don't have it available at the moment, I can post it later on. Also, Take in consideration that pre build event gives you practically unlimited options. If you are comfortable with C# (or any other language), just write a small program that will do the required modification and call it from the pre-build event. – Avi Turner Jun 18 '14 at 18:25
1

You could write a custom MSBuild action that updates an assembly attribute in a known file prior to compilation. This has the downside of having to install the custom build step on all dev machines and any build machines.

RikRak
  • 898
  • 1
  • 7
  • 21
  • Unfortunately not, but the [MSBuildTasks](https://github.com/loresoft/msbuildtasks) might be helpful, particularly the [AssemblyInfo](https://github.com/loresoft/msbuildtasks/blob/master/Source/MSBuild.Community.Tasks/AssemblyInfo.cs) task. This should give you a good start in how to update or create the AssemblyInfo.cs file as part of the build process. There is also a User task that will provide the name of the current User (there are other tasks that can provide details about the build machine too). – RikRak Jun 19 '14 at 10:51
0

So here is I found I am trying trick.

I have created new custom attribute AssemblyCompiler. And by changing and using powershell script shown here . Seems it works.

Another C# solution

  1. Create new custom attribute
  2. write c# program to update/add username
  3. call that c# code on prebuild event as follows

call ....\Resources\OverwriteAssemblyInfo.exe [ I placed my the executable file in resources]