Copy the desired assembly resource out of its container assembly into the container assembly's directory or into a subdirectory. Then load the copied assembly into your application. This would be significantly easier then trying to change a private field (or the result of a function call).
The Assembly class exposes a public interface - they way it's supposed to be used. Attempting to modify the internal working of the class could cause you major problems, assuming it's even possible. Some future version, or even just a regular update, could change the internal workings of the class and break your code. You also cannot predict what other parts of the class are dependent on that field. Changing its value could have unintended consequences futher on. You are proposing changing the class from its defined behavior which could cause other assemblies or programmers further down the road confusion and frustration. That's why this field was implemented as read-only and that's why .NET provides no easy way to modify read-only values.
UPDATE
Here's the source code for the Location property:
[System.Security.SecurityCritical] // auto-generated
[ResourceExposure(ResourceScope.Machine)]
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
[SuppressUnmanagedCodeSecurity]
private static extern void GetLocation(RuntimeAssembly assembly,
StringHandleOnStack retString);
public override String Location
{
[System.Security.SecuritySafeCritical] // auto-generated
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
get {
String location = null;
GetLocation(GetNativeHandle(),
JitHelpers.GetStringHandleOnStack(ref location));
if (location != null)
new FileIOPermission( FileIOPermissionAccess.PathDiscovery, location ).Demand();
return location;
}
}
Note that this code is actually located inside an undocumented class named RuntimeAssembly which is defined as internal
within the Assembly class. You can see the full source code here:
http://www.dotnetframework.org/default.aspx/4@0/4@0/DEVDIV_TFS/Dev10/Releases/RTMRel/ndp/clr/src/BCL/System/Reflection/Assembly@cs/1305376/Assembly@cs
As you can see, there is no backing field here to modify. There is no way to override the Location property as you desire (without rewriting pieces of the Windows OS).
AND... just in case you get a hankerin' for rewriting that GetLocation function, you may be interested in this Q/A:
What is [DllImport("QCall")]?
(It probably goes without saying that, at this point, you are on your own.)