Pergunta

I have updater for my app. When i check for updates, i compare server version with local Assembly version of main .exe file of application. When from updater(updater is another .exe file) i get assembly version of my main .exe file of application, this file is blocked.. How i can get assembly version of my project without blocking for rewriting? Keep version of assembly in XML file is not good idea. Thanks

Foi útil?

Solução

You just need the AssemblyName to get the version :

AssemblyName.GetAssemblyName(filename);

Outras dicas

A quick (and dirty) way would be to copy the main exe to a temporary file and load it from there.

A more elegant solution would be to create a separate AppDomain and load the main exe there. Since you're only after the version, it should be fairly straightforward to get the data over the bridge between the app domains. The app domain could then be unloaded once you have the version.

I'm assuming you are loading the assembly to check the version.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top