Question

Can someone tell me how I can use the binary compatibilty in VS2010?

I have a project that evertime I build with a new assembly file with the new version changes the CLSID of the dll.

I already use that CLSID hardcoded in my WiX package to register that dll as a com+ but if it is to change on every build would mean I should update my WiX package with evey new version.

Any ideas ??

Edit 1

I should mention that this CLSID is the one that appears along side your Application ID in the properties window of your newley registered Com+ in component services. I have to hardcode them into the WiX file so it gets registered on install

Edit 2

Here is a link to another question that is related to what I am asking for more information WiX - Register ComPlus application and Assigning a role to a component

Was it helpful?

Solution

I have found the solution thanks to MSDN,

By default, when you rebuild an assembly it is assigned a new version number. This is because Visual Studio .NET sets the AssemblyVersion attribute to "1.0.*" for new projects. As a result, a new Class Identifier (CLSID) is generated for serviced components each time the assembly is rebuilt.

Note This behavior is slightly different between C# and Visual Basic .NET projects. For C# projects, the assembly version is incremented every time it is rebuilt. For Visual Basic .NET projects, the assembly version is incremented the first time the project is rebuilt after it is loaded into Visual Studio .NET. Subsequent rebuilds within the same instance of Visual Studio .NET do not result in the assembly version being incremented.

This does not represent a problem, because the assembly version is for information only in assemblies that do not have a strong name. For strong named assemblies, you should use static version numbers that are manually maintained. This and other versioning issues are discussed further in Controlling Assembly Version in Chapter 5, "The Build Process".

In order to control the CLSID that serviced components end up with in the COM+ catalog and avoid multiple versions appearing each time a developer rebuilds the serviced component, use either of the following approaches:

1.Explicitly control the CLSID by using the following Guid attribute:

[Guid("2136360E-FEBC-475a-95B4-3DDDD586E52A")]
public interface IFoo
{}

[TransactionAttribute(TransactionOption.Required),
Guid("57F01F20-9C0C-4e63-9588-720D5D537E66")]
public class Foo: ServicedComponent, IFoo
{}

2.Maintain a static assembly version number for the serviced component's assembly and don't use the Visual Studio .NET default "1.0.*" version numbering scheme. For more information about assembly versioning, see Controlling Assembly Version in Chapter 5, "The Build Process."

I used the first method. Worked a treat.

http://msdn.microsoft.com/en-us/library/ee817675.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top