Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make an automation for build from source #433

Open
sotalvaro opened this issue Sep 6, 2023 · 24 comments
Open

How to make an automation for build from source #433

sotalvaro opened this issue Sep 6, 2023 · 24 comments

Comments

@sotalvaro
Copy link

sotalvaro commented Sep 6, 2023

Hi Adam. If I need to execute the same routine that you post in there I can see the in the same method? but i need to change just this MSAccessVCS.Exportsource for what word man.
image
image

Just need to change right this
image
image

@joyfullservice
Copy link
Owner

@sotalvaro - Check out this discussion: #430

I posted some code samples there, both from VBA and PowerShell. Let me know how it goes!

@sotalvaro
Copy link
Author

sotalvaro commented Sep 7, 2023

Hi Adam, this method its great I tested and works really good:
image

But one more question man you have any idea of how can I close the access file when the event of build from source finish?

@joyfullservice
Copy link
Owner

Just uncomment that last line to quit the application.

@sotalvaro
Copy link
Author

Adam I uncommented the line but close the app even without beginning the process of build

@joyfullservice
Copy link
Owner

Gotcha. It sounds like we need to make the script pause until the call completes. I don't have a whole lot of experience with PowerShell COM automation, but please post back here with what you find out. 👍

@sotalvaro
Copy link
Author

Adam Can I make a question for you but is another thing different of vcs, may you know the solution man. thanks a lot for everything

@joyfullservice
Copy link
Owner

FYI, on the technical side, I think what we are probably experiencing here is that the build process uses a WinAPI timer to release the call stack of the calling function so that it can run the build without dangling object references and active code causing database corruption or triggering an application crash. This means that the Application.Run command will technically finish, and move on to the next line in the PowerShell script, even though the build operation is still in process.

I am open to ideas on the best way to handle this... 🤔 One approach would be to have the build process set an environment variable when the operation completes, and PowerShell could loop and watch for that variable. That would also provide a mechanism for other CI integrations to confirm the success of the build.

@joyfullservice
Copy link
Owner

Adam Can I make a question for you but is another thing different of vcs, may you know the solution man. thanks a lot for everything

I like helping people, but it is probably better to keep this project focused on VCS. Depending on your question, there are other online forums like StackOverflow or Quora where many users enjoy helping others. I often find solutions on those sites myself. 😄

@hecon5
Copy link
Contributor

hecon5 commented Sep 7, 2023

environment variable

I am a fan of this, even at the potential cost of carry as it would cut down on the requirements for building.

@sotalvaro
Copy link
Author

FYI, on the technical side, I think what we are probably experiencing here is that the build process uses a WinAPI timer to release the call stack of the calling function so that it can run the build without dangling object references and active code causing database corruption or triggering an application crash. This means that the Application.Run command will technically finish, and move on to the next line in the PowerShell script, even though the build operation is still in process.

I am open to ideas on the best way to handle this... 🤔 One approach would be to have the build process set an environment variable when the operation completes, and PowerShell could loop and watch for that variable. That would also provide a mechanism for other CI integrations to confirm the success of the build.

Man I found an command that we can help us "wait-event" but I don't be clear how can I use man

@hecon5
Copy link
Contributor

hecon5 commented Sep 8, 2023

I am wondering, is the build and deploy automation in or out of scope from the perspective of this project? I've put some starter docs in HERE: https://github.com/msaccess-vcs-integration/msaccess-devops, but I'm wondering if the automation components (beyond the hooks / API requirements) should be better suited for the devops repo?

@sotalvaro
Copy link
Author

I am wondering, is the build and deploy automation in or out of scope from the perspective of this project? I've put some starter docs in HERE: https://github.com/msaccess-vcs-integration/msaccess-devops, but I'm wondering if the automation components (beyond the hooks / API requirements) should be better suited for the devops repo?

Hey man Thanks a lot for the information I'll read all the repository and I hope I can use man

@sotalvaro
Copy link
Author

@sotalvaro - Check out this discussion: #430

I posted some code samples there, both from VBA and PowerShell. Let me know how it goes!

Adam can you have any idea to this error?
image

I Create the script of PowerShell man, works one time but after that start to show me this error message always than I tried to execute this script man.

@hecon5
Copy link
Contributor

hecon5 commented Sep 8, 2023

Can you share the script here? That may help, too.

@sotalvaro
Copy link
Author

sotalvaro commented Sep 8, 2023

Can you share the script here? That may help, too.

Thanks man @hecon5

`$app = New-Object -ComObject "Access.Application"

$app.Visible = -1
$app.RunCommand(10)

$app.OpenCurrentDatabase("C:\BioPayApp\BioPayCitrix.accdb")

try
{
$app.Run("C:\Users\sotalvaro\AppData\Roaming\MSAccessVCS\VERSION CONTROL.ACCDA!DummyFunction")
}
catch
{

}

$app.Run("MSAccessVCS.SetInteractionMode", [ref]1)
$app.Run("MSAccessVCS.HandleRibbonCommand", [ref]"btnBuild")

Wait-Event -Timeout 450

$app.Quit()`

@sotalvaro
Copy link
Author

Can you share the script here? That may help, too.

This is the error message that I got in the release pipeline:

image

@sotalvaro
Copy link
Author

I am wondering, is the build and deploy automation in or out of scope from the perspective of this project? I've put some starter docs in HERE: https://github.com/msaccess-vcs-integration/msaccess-devops, but I'm wondering if the automation components (beyond the hooks / API requirements) should be better suited for the devops repo?

Man I don't understand very well how I can use this tool man, may you have a video in youtube or other documentation that I can watch or read

@joyfullservice
Copy link
Owner

If you are looking for documentation on the VCS Add-in project, check out the wiki. I don't have any tutorial videos at this point, but I have considered making some to help out new users...

@sotalvaro
Copy link
Author

If you are looking for documentation on the VCS Add-in project, check out the wiki. I don't have any tutorial videos at this point, but I have considered making some to help out new users...

Thanks Adam may you have any idea about the error in the PowerShell script?

@joyfullservice
Copy link
Owner

In regards to the PowerShell script, it seems that Access is crashing during the build process. This is probably not an issue with the PowerShell script, but something related to the add-in or possibly a file corruption issue. (Such as an object reference that wasn't released properly and caused the add-in file to become corrupted.)

To troubleshoot this, the best thing is to see if you can narrow down the scope of the problem to pinpoint where it is occurring. For example, try running your build script on a very simple test database. Does it still crash? If so, try reinstalling the add-in. If it still crashes with a very small and simple test database, then try running the build manually through the ribbon command instead of the PowerShell script.

Keep testing different angles till you are able to pinpoint exactly when the crash occurs. Is it related to a specific object type that it is trying to import, or does it only happen when you trigger the build from the PowerShell script? Hope that helps!

@sotalvaro
Copy link
Author

In regards to the PowerShell script, it seems that Access is crashing during the build process. This is probably not an issue with the PowerShell script, but something related to the add-in or possibly a file corruption issue. (Such as an object reference that wasn't released properly and caused the add-in file to become corrupted.)

To troubleshoot this, the best thing is to see if you can narrow down the scope of the problem to pinpoint where it is occurring. For example, try running your build script on a very simple test database. Does it still crash? If so, try reinstalling the add-in. If it still crashes with a very small and simple test database, then try running the build manually through the ribbon command instead of the PowerShell script.

Keep testing different angles till you are able to pinpoint exactly when the crash occurs. Is it related to a specific object type that it is trying to import, or does it only happen when you trigger the build from the PowerShell script? Hope that helps!

Man I tried manually and works, tried an manually execution of the script inside my environment and sometimes crashes and sometimes works but with the release pipeline always crashes man how uninstall the add in, I need reinstall and tried again man

@mwolfe02
Copy link

with the release pipeline always crashes

Is your release pipeline running as a non-interactive user? If so, Microsoft does not support that scenario for any of its Office products, but there are (undocumented) steps you can take to make it work. This is a common issue when using Windows Task Scheduler to automate Access and Excel.

@joyfullservice
Copy link
Owner

joyfullservice commented Sep 11, 2023

@sotalvaro - The reason for the error is documented in the above code sample. This error is expected and should be ignored. The important thing is that the call to the "dummy function" actually loads the add-in file. After the add-in is loaded, then you can then call the add-in function that you actually want to run.

Also, see this discussion for an improved VBA code sample for loading the add-in and building from source.

@sotalvaro
Copy link
Author

sotalvaro commented Sep 11, 2023

@sotalvaro - The reason for the error is documented in the above code sample. This error is expected and should be ignored. The important thing is that the call to the "dummy function" actually loads the add-in file. After the add-in is loaded, then you can then call the add-in function that you actually want to run.

Ok man I got you but when I tried to load the function that I wanted I get this error message>
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants