![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Versioning I'm developing a plug-in system that other people are going to write modules for. I have an interface defined, and then I have an abstract class that implements that interface. In my abstract class, I have several functions that a person must implement, and I also have a function that I want to implement for them. It basically looks like this: public abstract class MyBaseModule : IMyInterface { public abstract void A(); public abstract void B(); public abstract void C(); public Version GetBaseVersion() { return Assembly.GetExecutingAssembly().GetName().Version; } } I basically just want to get the version of the base module that somebody used to build their module against. Here's how my project works: I have 1 directory that has everything in it (it's not a big solution). The directory includes my solution, my base module assembly, and all of the plug-in modules. If I update my base module assembly, every module will now return the new base version. That makes sense looking at the code above, but that's not what I want. I want the version of the assembly that a particular module built against, but I don't know how to do that. Any ideas on how I can make this happen? I basically want to force them to implement an abstract method, but I also want to implement the abstract method for them. Thanks. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Versioning Untested: The assemblyName will be the (usually) the .dll name without the ".dll" extension on it. private static string FindVersion( string assemblyName ) { string returnValue = string.Empty; Assembly assem = Assembly.Load( assemblyName ); if(null != assem) { returnValue = assem.GetName().Version; } return returnValue ; } "Tom" <johnthompson1@xxxxxx> wrote in message news:0071374D-7BCC-4776-9C42-722AF6E7C0DB@xxxxxx Quote: > I'm developing a plug-in system that other people are going to write > modules for. I have an interface defined, and then I have an abstract > class that implements that interface. In my abstract class, I have > several functions that a person must implement, and I also have a function > that I want to implement for them. It basically looks like this: > > public abstract class MyBaseModule : IMyInterface > { > public abstract void A(); > public abstract void B(); > public abstract void C(); > > public Version GetBaseVersion() > { > return Assembly.GetExecutingAssembly().GetName().Version; > } > } > > I basically just want to get the version of the base module that somebody > used to build their module against. Here's how my project works: > > I have 1 directory that has everything in it (it's not a big solution). > The directory includes my solution, my base module assembly, and all of > the plug-in modules. If I update my base module assembly, every module > will now return the new base version. That makes sense looking at the > code above, but that's not what I want. I want the version of the > assembly that a particular module built against, but I don't know how to > do that. Any ideas on how I can make this happen? I basically want to > force them to implement an abstract method, but I also want to implement > the abstract method for them. > > Thanks. > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Versioning But won't that just return me the version of the plug-in module dll? I think I want the version of the base module that they built again. I think I'm kindof asking for a way to implement a function in a base module that will always be inherited in an inline way. Basically, I want to return the version of my base module in their (the plug-in module) actual assembly without the plug-in module calling into the base module assembly. "sloan" <sloan@xxxxxx> wrote in message news:uKIvVukpJHA.996@xxxxxx Quote: > Untested: > > > The assemblyName will be the (usually) the .dll name without the ".dll" > extension on it. > > private static string FindVersion( string assemblyName ) > { > string returnValue = string.Empty; > Assembly assem = Assembly.Load( assemblyName ); > if(null != assem) > { > returnValue = assem.GetName().Version; > > } > return returnValue ; > > } > > > > > "Tom" <johnthompson1@xxxxxx> wrote in message > news:0071374D-7BCC-4776-9C42-722AF6E7C0DB@xxxxxx Quote: >> I'm developing a plug-in system that other people are going to write >> modules for. I have an interface defined, and then I have an abstract >> class that implements that interface. In my abstract class, I have >> several functions that a person must implement, and I also have a >> function that I want to implement for them. It basically looks like >> this: >> >> public abstract class MyBaseModule : IMyInterface >> { >> public abstract void A(); >> public abstract void B(); >> public abstract void C(); >> >> public Version GetBaseVersion() >> { >> return Assembly.GetExecutingAssembly().GetName().Version; >> } >> } >> >> I basically just want to get the version of the base module that somebody >> used to build their module against. Here's how my project works: >> >> I have 1 directory that has everything in it (it's not a big solution). >> The directory includes my solution, my base module assembly, and all of >> the plug-in modules. If I update my base module assembly, every module >> will now return the new base version. That makes sense looking at the >> code above, but that's not what I want. I want the version of the >> assembly that a particular module built against, but I don't know how to >> do that. Any ideas on how I can make this happen? I basically want to >> force them to implement an abstract method, but I also want to implement >> the abstract method for them. >> >> Thanks. >> >> > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Versioning i think the answer to this is to strong name the base module. any better ideas? "Tom" <johnthompson1@xxxxxx> wrote in message news:084113C4-94E8-43FD-901C-0E9846FEFA6C@xxxxxx Quote: > But won't that just return me the version of the plug-in module dll? I > think I want the version of the base module that they built again. I > think I'm kindof asking for a way to implement a function in a base module > that will always be inherited in an inline way. Basically, I want to > return the version of my base module in their (the plug-in module) actual > assembly without the plug-in module calling into the base module assembly. > > > > "sloan" <sloan@xxxxxx> wrote in message > news:uKIvVukpJHA.996@xxxxxx Quote: >> Untested: >> >> >> The assemblyName will be the (usually) the .dll name without the ".dll" >> extension on it. >> >> private static string FindVersion( string assemblyName ) >> { >> string returnValue = string.Empty; >> Assembly assem = Assembly.Load( assemblyName ); >> if(null != assem) >> { >> returnValue = assem.GetName().Version; >> >> } >> return returnValue ; >> >> } >> >> >> >> >> "Tom" <johnthompson1@xxxxxx> wrote in message >> news:0071374D-7BCC-4776-9C42-722AF6E7C0DB@xxxxxx Quote: >>> I'm developing a plug-in system that other people are going to write >>> modules for. I have an interface defined, and then I have an abstract >>> class that implements that interface. In my abstract class, I have >>> several functions that a person must implement, and I also have a >>> function that I want to implement for them. It basically looks like >>> this: >>> >>> public abstract class MyBaseModule : IMyInterface >>> { >>> public abstract void A(); >>> public abstract void B(); >>> public abstract void C(); >>> >>> public Version GetBaseVersion() >>> { >>> return Assembly.GetExecutingAssembly().GetName().Version; >>> } >>> } >>> >>> I basically just want to get the version of the base module that >>> somebody used to build their module against. Here's how my project >>> works: >>> >>> I have 1 directory that has everything in it (it's not a big solution). >>> The directory includes my solution, my base module assembly, and all of >>> the plug-in modules. If I update my base module assembly, every module >>> will now return the new base version. That makes sense looking at the >>> code above, but that's not what I want. I want the version of the >>> assembly that a particular module built against, but I don't know how to >>> do that. Any ideas on how I can make this happen? I basically want to >>> force them to implement an abstract method, but I also want to implement >>> the abstract method for them. >>> >>> Thanks. >>> >>> >> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Versioning On Mar 16, 7:48*am, "Tom" <johnthomps...@xxxxxx> wrote: Quote: > I'm developing a plug-in system that other people are going to write modules > for. *I have an interface defined, and then I have an abstract class that > implements that interface. *In my abstract class, I have several functions > that a person must implement, and I also have a function that I want to > implement for them. *It basically looks like this: > > public abstract class MyBaseModule : IMyInterface > { > * public abstract void A(); > * public abstract void B(); > * public abstract void C(); > > * public Version GetBaseVersion() > * { > * * return Assembly.GetExecutingAssembly().GetName().Version; > * } > > } > > I basically just want to get the version of the base module that somebody > used to build their module against. *Here's how my project works: > > I have 1 directory that has everything in it (it's not a big solution). *The > directory includes my solution, my base module assembly, and all of the > plug-in modules. *If I update my base module assembly, every module will now > return the new base version. *That makes sense looking at the code above, > but that's not what I want. *I want the version of the assembly that a > particular module built against, but I don't know how to do that. *Any ideas > on how I can make this happen? *I basically want to force them to implement > an abstract method, but I also want to implement the abstract method for > them. public interfaces that you have already published, nor should you add abstract members to published classes. If you want to provide different functionality for old and new add-ins, just keep the existing interfaces for old ones, and provide new interfaces for new ones. In any case, how would you "force them to implement an abstract method, but ... also ... implement the abstract method for them" at the same time? Reflection.Emit hacks? |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Versioning On Mar 16, 8:33*pm, "Tom" <johnthomps...@xxxxxx> wrote: Quote: > But won't that just return me the version of the plug-in module dll? *I > think I want the version of the base module that they built again. *I think > I'm kindof asking for a way to implement a function in a base module that > will always be inherited in an inline way. *Basically, I want to returnthe > version of my base module in their (the plug-in module) actual assembly > without the plug-in module calling into the base module assembly. > > "sloan" <sl...@xxxxxx> wrote in message > > news:uKIvVukpJHA.996@xxxxxx > > > Quote: > > Untested: Quote: > > The assemblyName will be the (usually) the .dll name without the ".dll" > > extension on it. Quote: > > private static string FindVersion( string assemblyName ) > > *{ > > * string returnValue = string.Empty; > > * Assembly assem = Assembly.Load( assemblyName ); > > * if(null != assem) > > * { > > * *returnValue = assem.GetName().Version; Quote: > > * } > > * return returnValue ; Quote: > > *} Quote: > > "Tom" <johnthomps...@xxxxxx> wrote in message > >news:0071374D-7BCC-4776-9C42-722AF6E7C0DB@xxxxxx Quote: > >> I'm developing a plug-in system that other people are going to write > >> modules for. *I have an interface defined, and then I have an abstract > >> class that implements that interface. *In my abstract class, I have > >> several functions that a person must implement, and I also have a > >> function that I want to implement for them. *It basically looks like > >> this: Quote: Quote: > >> public abstract class MyBaseModule : IMyInterface > >> { > >> *public abstract void A(); > >> *public abstract void B(); > >> *public abstract void C(); Quote: Quote: > >> *public Version GetBaseVersion() > >> *{ > >> * *return Assembly.GetExecutingAssembly().GetName().Version; > >> *} > >> } Quote: Quote: > >> I basically just want to get the version of the base module that somebody > >> used to build their module against. *Here's how my project works: Quote: Quote: > >> I have 1 directory that has everything in it (it's not a big solution).. > >> The directory includes my solution, my base module assembly, and all of > >> the plug-in modules. *If I update my base module assembly, every module > >> will now return the new base version. *That makes sense looking at the > >> code above, but that's not what I want. *I want the version of the > >> assembly that a particular module built against, but I don't know how to > >> do that. *Any ideas on how I can make this happen? *I basically want to > >> force them to implement an abstract method, but I also want to implement > >> the abstract method for them. Quote: Quote: > >> Thanks.- Hide quoted text - > - Show quoted text - If you have different versions of Interface-Only Assemblies installed in GAC, which plugin buit against, using [Specific Version=True] feature, so you need just call typeof(AbstractType).Assembly.GetName() which returns AssemblyName object with info If you have not placed it in GAC, please, sign it using strong name and publish it in GAC, because this kind of assembly (never-changed, multi-versioned assemblies) must support multiversioning and be accessible. Generally, the only way to achieve this is use the GAC. Beware, you abstract type in different assemblies versions will not be the same type, even if Type.Name, Type.GUID etc. are the same. |
My System Specs![]() |