Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to replace all the references in my newly copied assembly model. But when I run the code, it gives me the error below. I cannot figure out what's wrong with the code.
Public Function assemblyDescriptor(assmFileName As String, oSuff As String)
' assmFileName is the full loction of the new assembly, and oSuff is the suffix
Dim assDoc As AssemblyDocument = ThisApplication.Documents.Open(assmFileName, False)
Dim ostr As String =""
For Each occ As DocumentDescriptor In assDoc.ReferencedDocumentDescriptors
Dim oSubDir As String = System.IO.Path.GetDirectoryName(occ.FullDocumentName)
Dim oSubFileName As String = System.IO.Path.GetFileNameWithoutExtension(occ.FullDocumentName)
Dim oSubFileExt As String = System.IO.Path.GetExtension(occ.FullDocumentName)
Dim oSubNewFileName As String = oSubDir & oSuff & "\" & oSubFileName & oSuff & oSubFileExt
If System.IO.File.Exists(oSubNewFileName) Then
Try
occ.ReferencedFileDescriptor.ReplaceReference(oSubNewFileName)
assDoc.Update
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
ostr += oSubNewFileName & vbCrLf
End If
Next
MessageBox.Show(ostr)
assDoc.Update
End Function
Solved! Go to Solution.