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

DevEnv takes a long time to initialize #5301

Closed
2 of 7 tasks
MH-ZShearer opened this issue Mar 29, 2022 · 28 comments
Closed
2 of 7 tasks

DevEnv takes a long time to initialize #5301

MH-ZShearer opened this issue Mar 29, 2022 · 28 comments
Labels
Area: Scripting and command line awaiting-deployment Code complete; awaiting deployment and/or deployment in progress bug report investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Windows

Comments

@MH-ZShearer
Copy link

Description

In order to build a Visual Studio Installer Project (.vdproj), Visual Studio must be ran via DevEnv.exe. When building the installer, it takes anywhere from 2-10. This appears to be regression from #128. I'm not sure when the regression initially occurred as this is the first time I needed DevEnv.

In the reproduction steps below, I use seanmiddleditch/gha-setup-vsdevenv@v4. This appears to be required to ensure the installer is built due to the behavior of DevEnv.exe. It seems likely that you may be able to start and wait for the DevEnv process to finish, but I doubt that will result in a faster build. This action does add a lot of clutter to the environment variables as well.

Unfortunately, all our repositories are private and can't be shared publicly. For troubleshooting, I attempted to test our Action against windows-2019 based on #128. I experienced the same issue, as mentioned in Actual Behavior.

Virtual environments affected

  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10.15
  • macOS 11
  • Windows Server 2016
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

windows-2019 -> 20220316.1
windows-2022 -> 20220316.1

Is it regression?

Maybe, see description

Expected behavior

I expected about 20-30 seconds, but I'd be happy with less than 120 seconds.

Actual behavior

It takes at least 2 minutes to start DevEnv, but typically takes 5-10 minutes. The last two runs clocked in at 8:40 and 8:28 on windows-2022 and windows-2019, respectively.

Repro steps

name: DevEnv Test
on: workflow_dispatch
jobs:
  build:
    runs-on: windows-latest
    steps:
    - name: Setup MSBuild.exe
      uses: microsoft/[email protected]

    - name: Setup VS Dev Environment
      uses: seanmiddleditch/gha-setup-vsdevenv@v4

    - name: Restore NuGet Packages
      run: msbuild /t:Restore

    - name: Build the application
      run: msbuild /t:Build /p:Configuration=Release

    # Required to Build VS Installer Projects
    - name: Disable Out of Process Building
      run: .\DisableOutOfProcBuild.exe
      working-directory: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild

    # Can take 10+ minutes to complete
    - name: Build the Installer
      run: DevEnv Installer/Installer.vdproj /build Release
@al-cheb al-cheb added Area: Scripting and command line OS: Windows investigate Collect additional information, like space on disk, other tool incompatibilities etc. and removed needs triage labels Mar 30, 2022
@al-cheb
Copy link
Contributor

al-cheb commented Mar 30, 2022

Hello @MH-ZShearer ,
We will take a look at it.

@al-cheb al-cheb self-assigned this Apr 1, 2022
@flameshikari
Copy link

Hello there, I have the same problem. Any progress?

@al-cheb
Copy link
Contributor

al-cheb commented Jul 20, 2022

Hello there, I have the same problem. Any progress?

Currently, no updates.

@domenichelfenstein
Copy link

I'm also having the same problem. Initialization takes 10min on windows-2022.
Doing the exact same thing as @MH-ZShearer (building an installer)

@delta42
Copy link

delta42 commented Oct 16, 2022

In the same boat

@al-cheb al-cheb removed their assignment Nov 14, 2022
@f4l0
Copy link

f4l0 commented Dec 19, 2022

Same on my side...

@ReMinoer
Copy link

Same here. I'm building an installer with devenv and it can easily take 10+ minutes.

@martinmueller4voice
Copy link

Same for me. Just created a setup project for VS2022 and it takes at least about 5-6 minutes for VS to start.

Wed, 03 May 2023 12:41:18 GMT Run devenv.com $env:Solution_Name /rebuild "$env:Configuration|x86" /project $env:Installer_Project /log
Wed, 03 May 2023 12:47:54 GMT Microsoft Visual Studio 2022 Version 17.5.4.
Wed, 03 May 2023 12:47:54 GMT Copyright (C) Microsoft Corp. All rights reserved.
...
Wed, 03 May 2023 12:52:25 GMT ========== Rebuild started at 12:47 PM and took 04:34.916 minutes ==========

And that's all time being billed for. 👎

On my own machine, the same build took 23.472 seconds

Spidy123222 added a commit to SideStore/SideServer-Windows that referenced this issue Jun 17, 2023
This adds msi and devenv to build the msi installer as vscode doesn’t support building directly from a visual studio code project from a vdproject using msbuild. So using devenv is needed to build it. For reference. actions/runner-images#5301

Signed-off-by: Spidy123222 <[email protected]>
Spidy123222 added a commit to SideStore/SideServer-Windows that referenced this issue Jun 17, 2023
This adds msi and devenv to build the msi installer as vscode doesn’t support building directly from a visual studio code project from a vdproject using msbuild. So using devenv is needed to build it. For reference. actions/runner-images#5301

Signed-off-by: Spidy123222 <[email protected]>
@mikhailkoliada mikhailkoliada added the awaiting-deployment Code complete; awaiting deployment and/or deployment in progress label Jun 18, 2023
@martinmueller4voice
Copy link

martinmueller4voice commented Jun 23, 2023 via email

@ilia-shipitsin
Copy link
Contributor

it was a false alarm from my side.
I'll check next week

@martinmueller4voice
Copy link

Ok, no problem.
Got a bit too excited :)
I'm looking forward to your next update.

@mikhailkoliada
Copy link
Contributor

Should be deployed now

@martinmueller4voice
Copy link

Great, thank you so much!!
Those are the run times with the last runner version:

Mon, 26 Jun 2023 11:37:21 GMT Runner Image
Mon, 26 Jun 2023 11:37:21 GMT Image: windows-2022
Mon, 26 Jun 2023 11:37:21 GMT Version: 20230620.1.0

Mon, 26 Jun 2023 11:39:56 GMT Run devenv.com $env:Solution_Name /rebuild "$env:Configuration|x86" /project $env:Installer_Project /log
Mon, 26 Jun 2023 11:39:56 GMT
Mon, 26 Jun 2023 11:41:16 GMT Microsoft Visual Studio 2022 Version 17.6.4.
Mon, 26 Jun 2023 11:41:16 GMT Copyright (C) Microsoft Corp. All rights reserved.
Mon, 26 Jun 2023 11:41:16 GMT The license for Visual Studio expires in 24 days.
Mon, 26 Jun 2023 11:41:16 GMT Rebuild started...

1:20 minutes is a lot better than the ~7 minutes it took before.

Thanks again!

@Cyberboss
Copy link

Cyberboss commented Jun 26, 2023

@MH-ZShearer
Copy link
Author

I've noticed no perceivable difference than before. It still takes several minutes to even start devenv. The last 3 runs took 6:23, 6:28, and 7:57 minutes each just to start devenv with the entire build taking roughly 3 minutes longer each.

@martinmueller4voice since it appears to be working for you, it may be possible that we're setting up our devenv a bit differently, if that can even make a difference. Does your workflow differ from my original post? Are you able to post at least the important parts of your workflow for comparison?

@martinmueller4voice
Copy link

Hmmm - I don't know what's going on...
Those are the build durations for the last 3 builds:
image

The 6 1/2 minute run was the one that made me cheer.
But the build from last week took >10 minutes again, while everything I had changed was the tag.

The fast run was with runner Version: 20230620.1.0
The latest, slow run was with runner Version: 20230625.1.0

So from my point of view, something changed between 20230620 and 20230625 that reverted the speedup again.

@ilia-shipitsin
Copy link
Contributor

@martinmueller4voice , I've added "vdproj" warmup. Warmup itself is simple vdproj.
can you share your details ? some project that is slow

@martinmueller4voice
Copy link

My projecct mainly contains those steps to build the setup project:

# Install the .NET 7 workload
- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

# Install GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

# Setup NuGet
- name: Setup Nuget
uses: NuGet/[email protected]

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/[email protected]

# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet test -c Debug # Or else it looks as if Release is selected and there the .vdproj cannot be loaded

# Setup devenv environment
- name: Setup VS Dev Environment
uses: seanmiddleditch/gha-setup-vsdevenv@v4

# Copy asp.net 7 x86 prerequisite Bootstrapper package
- name: Copy ASP.NET 7 x86 Bootstrapper package
run: dotnet run --project $env:SetupHelper

# Build installer
- name: Build installer
run: devenv.com $env:Solution_Name /rebuild "$env:Configuration|x86" /project $env:Installer_Project /log

As you can see, the last step is the first one where devenv is actually started.

With the exact same steps, the build using 20230620.1 took 1:19 min to start devenv.com:
Mon, 26 Jun 2023 11:39:57 GMT Run devenv.com $env:Solution_Name /rebuild "$env:Configuration|x86" /project $env:Installer_Project /log
Mon, 26 Jun 2023 11:41:16 GMT
Mon, 26 Jun 2023 11:41:16 GMT Microsoft Visual Studio 2022 Version 17.6.4.

The build using the 20230625.1 runner took 5:13 min again to start devenv.com:
Wed, 05 Jul 2023 12:36:31 GMT Run devenv.com $env:Solution_Name /rebuild "$env:Configuration|x86" /project $env:Installer_Project /log
Wed, 05 Jul 2023 12:41:44 GMT
Wed, 05 Jul 2023 12:41:44 GMT Microsoft Visual Studio 2022 Version 17.6.4.

@woodne
Copy link

woodne commented Jul 24, 2023

Does this change based on the size of the runner we use or something? I am using larger 16 core runners for a build and when I just run devenv.exe /updateconfiguration it can take anywhere from like 1-2 minutes, up to as long as almost 20 mintes:
image
Is this expected behavior if the runner image already had this command run?

Runner information:

Current runner version: '2.306.0'
Runner name: 'win-server2022-latest-16core_155c5158a61a'
Runner group name: 'win-server2022-latest'
Machine name: 'runner'
Operating System
  Microsoft Windows Server 2022
  10.0.20348
  Datacenter
Runner Image
  Image: windows-2022
  Version: 20230716.1.0
  Included Software: https://github.com/actions/runner-images/blob/win22/20230716.1/images/win/Windows2022-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20230716.1

@mikhailkoliada
Copy link
Contributor

Images are the same, @maxim-lobanov any ideas?

@floydpreyes
Copy link

Can I ask if this is closed because it's a known issue?

@martinmueller4voice
Copy link

Since we already had short startup times at some point, I feel that getting this to work reliably is just a small step away, even though I cannot say for sure what @maxim-lobanov did exactly with those images.
I fear that, once it's a known issue, it will stay a known issue indefinitely.
Any other opinions?

@floydpreyes
Copy link

thanks @martinmueller4voice for the response, I ask because I've tested windows 2019 and windows 2022 images and running devenv.com can still anywhere between 10 to 20 mins each run. This is in Azure DevOps by the way.

@EduPonz
Copy link

EduPonz commented Feb 13, 2024

I still see very long times (~5 min) to simple start a dev shell in github hosted runners. Is there any update on this?

@martinmueller4voice
Copy link

Because there doesn't seem to be any progress, I thought I'd suggest using a local (self-hosted) runner.
Recently, I had to switch to a self-hosted runner because of new code signing requirements where you have to have a hardware module physically connected to the build machine.
Since this local runner doesn't have to be provisioned every time with a partially initialized VS, this can be a huge time saver.
And the best part: Self-hosted runners are not billed by minute.

@EduPonz
Copy link

EduPonz commented Feb 13, 2024

Hi @martinmueller4voice, thanks for your reply! Unfortunately, one of the reasons to migrate to github actions was to avoid maintaining servers for CI, so we'd like to avoid self-hosted runners if we can.

@eleazarcelis
Copy link

Hi, I'm using window-latest and I have the same problem, it's taking 10+ min to start devenv
image

@benediktadams
Copy link

benediktadams commented Jun 1, 2024

Same problem here, builds with devenv.exe take at least 5-10minutes to start up on a Github runner.... Is this still being worked on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Scripting and command line awaiting-deployment Code complete; awaiting deployment and/or deployment in progress bug report investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Windows
Projects
None yet
Development

No branches or pull requests