Using ALTER ASSEMBLY to refresh the bits of an existing assembly

According to the documentation, it looks that it's possible to use ALTER ASSEMBLY to change the contents of an existing assembly:

"If the FROM clause is specified, ALTER ASSEMBLY refreshes the assembly with respect to the latest copies of the modules located at the network location you specify."

However, if I execute:

CREATE ASSEMBLY [MyAssembly] FROM '\\mymachine\Test\MyAssembly.dll'
ALTER ASSEMBLY [MyAssembly] FROM '\\mymachine\Test\MyAssembly.dll'

I get the following error:

Msg 6285, Level 16, State 1, Line 2

ALTER ASSEMBLY failed because the assembly used as a source has the same MVID as an assembly currently registered.



Am I misreading the documentation, or this is not working as expected

Thanks




Answer this question

Using ALTER ASSEMBLY to refresh the bits of an existing assembly

  • Tom ODonnell

    So do I, so do I!!

    :-)

    Niels

  • JohnEwing

    Thanks Niels!

    I hope not to get a similar error when I do:

    INSERT INTO [Country] ([CountryId] ,[CountryName]) VALUES (1, 'US')
    UPDATE [Country] SET [CountryName] = 'US' WHERE CountryId = 1

    Smile


  • Nikolaus Brennig

    Try and do a minor code change and rebuild your assembly after you have run CREATE and then do ALTER. Then it'll work just fine.

    The error you're getting is basically telling you that no changes has been made to the assembly.

    Niels

  • Using ALTER ASSEMBLY to refresh the bits of an existing assembly