E_FAIL error on PackAndGo ProjectFile assignment in .NET 8 Add-in

E_FAIL error on PackAndGo ProjectFile assignment in .NET 8 Add-in

cgtyklsn
Explorer Explorer
280 Views
8 Replies
Message 1 of 9

E_FAIL error on PackAndGo ProjectFile assignment in .NET 8 Add-in

cgtyklsn
Explorer
Explorer

 

Hello,

I’m using Inventor 2025 and have an add-in project built with .NET 8.

I converted the PackAndGo example code from this article:
https://adndevblog.typepad.com/manufacturing/2013/05/use-packandgo-of-2014-api.html
to C# and tried to use it in my add-in. However, when assigning the ProjectFile property, I get the following error:

{"Error HRESULT E_FAIL has been returned from a call to a COM component."}

The same code works without issues in a Windows Forms app built with .NET Framework 4.7.2.

Any advice or experiences would be appreciated. Thanks in advance!

0 Likes
Accepted solutions (1)
281 Views
8 Replies
Replies (8)
Message 2 of 9

CGBenner
Community Manager
Community Manager

@cgtyklsn 

Welcome to the Community.  I have moved your post here to the Programming forum so the experts can try to help you with your question.  Good luck!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes
Message 3 of 9

CGBenner
Community Manager
Community Manager

@bradeneuropeArthur Is this something that you might be able to help with?

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

Message 4 of 9

bradeneuropeArthur
Mentor
Mentor

Could you share your code. This makes it easier for me!thanks 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 9

cgtyklsn
Explorer
Explorer

I already shared the link to the code in the post. Had you looked at it? @bradeneuropeArthur 

0 Likes
Message 6 of 9

bradeneuropeArthur
Mentor
Mentor
Accepted solution

Is that exact the same code you use?

 

   Public Sub main

        Dim oPacknGoComp As New PackAndGoLib.PackAndGoComponent
        Dim oPacknGo As PackAndGoLib.PackAndGo
		Try
		MkDir("C:\Temp\PackandGo")
		Catch
		End Try
        oPacknGo = oPacknGoComp.CreatePackAndGo(ThisDoc.Document.FullFileName, "C:\Temp\PackandGo")
        'oPacknGo.ProjectFile = "D:\Files\Inventor Projects\"
        Dim sRefFiles = New String() {}
        Dim sMissFiles = New Object
        oPacknGo.SkipLibraries = True
        oPacknGo.SkipStyles = True
        oPacknGo.SkipTemplates = True
        oPacknGo.CollectWorkgroups = False
        oPacknGo.KeepFolderHierarchy = True
        oPacknGo.IncludeLinkedFiles = True
        oPacknGo.SearchForReferencedFiles(sRefFiles, sMissFiles)
        oPacknGo.AddFilesToPackage(sRefFiles)
        oPacknGo.CreatePackage()

    End Sub

This will do from within Inventor!

Let me know your thoughts.

@CGBenner @cgtyklsn 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 7 of 9

cgtyklsn
Explorer
Explorer
0 Likes
Message 8 of 9

CGBenner
Community Manager
Community Manager

@cgtyklsn 

Did the information provided answer your question? If so, please use Accept Solution so that others may find this in the future. Thank you very much!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes
Message 9 of 9

cgtyklsn
Explorer
Explorer

A solution to this problem has not yet been provided.

0 Likes