Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i specify the module version id (MVID) when building a .net assembly?

We have some shared assemblies that get build automatically every night. When there are no changes made to the sources, i would expect the assembly binaries to be exactly the same as a previous version.

However, there seem to be minor differences between assemblies.

I have done some effort to determine the difference between two builds. I used ildasm to generate an il version, and compared the resulting text versions. The only difference (in IL) is the MVID (a random guid) in the module.

Some googling tells me that the module version id gets generated by the compiler, so it is possible to determine the build source, even when everything else is the same.

This MVID creates an artificial diff betweeen builds of the same code, and an artificial checkin of the resulting assembly.

Is it possible to supply the MVID to the C# compiler?

like image 628
oɔɯǝɹ Avatar asked Jan 20 '23 01:01

oɔɯǝɹ


1 Answers

The ECMA-335 standard says:

The MVID is a Guid used to distinguish between two versions of the same module

Based on this description, supplying this is an argument to C# compiler will defeat it's purpose since you can pass the same MVID for different builds so I would say No.

I think the easier way would be to build only when something changes not necessarily every night.

like image 69
jfs Avatar answered Jan 30 '23 09:01

jfs