XNA needs ability to change Assembly GUID

Monkey Forums/Monkey Bug Reports/XNA needs ability to change Assembly GUID

benmc(Posted 2012) [#1]
At the moment, every app I build for XNA has the same Assembly GUID which means that on Windows Phone, every app you build overwrites the other apps (uses the same storage space). Plus, I believe this will need to be changed before submission to the Windows Phone Marketplace.

The GUID appears to be hard-coded in the file:

MonkeyGame/MonkeyGame/Properties/AssemblyInfo.cs

Can this be auto-generated when the app is built, or become a CONFIG option that we can manually tweak?


Rone(Posted 2012) [#2]
You can add this to your monkey project:
#if TARGET="xna" then 
	#XNA_ASSEMBLY_GUID="52d54c07-1a2a-4bac-a6c1-1ffb3b9abcde"
#End 

"..\MonkeyPro66\targets\xna\MonkeyGame\MonkeyGame\Properties\AssemblyInfo.cs"
needs to be changed as follows
       [assembly: Guid(MonkeyConfig.XNA_ASSEMBLY_GUID)]

XNA_ASSEMBLY_GUID="52d54c07-1a2a-4bac-a6c1-1ffb3b9d65ba" should also be added to "..\MonkeyPro66\targets\xna\CONFIG.MONKEY"


benmc(Posted 2012) [#3]
@Rone, That's excellent, thank you.

Do you know if the Assembly GUID can be anything, or if there are formatting requirements?

EDIT:

This didn't appear to work, it just put MonkeyConfig.XNA_ASSEMBLY_GUID as the Assembly GUID. Doesn't look like Trans is parsing that file for MonkeyConfig vars.


Rone(Posted 2012) [#4]
Did you delete the .build folder? Cause it seems to work here...


benmc(Posted 2012) [#5]
I did, I deleted and started over from scratch. It builds fine, but when I go into VS and to the Assembly info, it is showing MonkeyConfig.XNA_ASSEMBLY_GUID instead of the Guid.

I'm using v66


Rone(Posted 2012) [#6]
yes, but it does not matter what is written in the dialog, AssemblyInfo.cs is crucial.
As long as .XNA_ASSEMBLY_GUID is const and a valid guid, it will work.

You can test it
class Helper
{
    public static string AssemblyGuidString(System.Reflection.Assembly assembly)
    {
        var objects = assembly.GetCustomAttributes(
                typeof(System.Runtime.InteropServices.GuidAttribute), false);

        if (objects != null && objects.Length > 0)
        {
            return ((System.Runtime.InteropServices.GuidAttribute)objects[0]).Value;
        }
        else
        {
            return String.Empty;
        }
    }
};

//...

var assa = System.Reflection.Assembly.GetExecutingAssembly();
var val = Helper.AssemblyGuidString(assa);
System.Console.WriteLine(val.ToString());