Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Per Bolmstedt 84 posts 380 karma points
    Sep 30, 2021 @ 07:16
    Per Bolmstedt
    0

    SourceCodeAuto model builder mode causes build & restart on every document type save

    SourceCodeAuto model builder mode causes build & restart on every document type save.

    1. Visual Studio 2019 (latest)
    2. Create an Umbraco Project (using the Visual Studio project template) and run the installer
    3. Change the model builder mode to SourceCodeAuto
    4. Save any document type
    5. Visual Studio builds the project
    6. Umbraco restarts

    Just wondering

    • if this can be turned off, or
    • if it's intentional (maybe it's a good thing), or
    • if I'm missing something (maybe it's a net5 thing).

    Using SourceCodeManual as a workaround for now.

  • Sebastiaan Janssen 5058 posts 15515 karma points MVP admin hq
    Sep 30, 2021 @ 08:56
    Sebastiaan Janssen
    101

    Visual Studio builds the project

    So here visual studio is restarting Umbraco for you because it saw new code] :-)

    It's a good thing! Your cshtml files will actually work when the models have been built.

    I tend to use dotnet watch instead which doesn't restart the site but keeps running builds when it detects changes, that might be a nicer experience for you too.

  • Tony Gledhill 6 posts 27 karma points
    Mar 24, 2022 @ 11:29
    Tony Gledhill
    0

    Hi Sebastiaan!

    I'm getting the same issue too.

    We are using dontnet watch during development and can see that the modelsbuilder generating files as we are making changes.

    During modelsbuilder re-generating the files, it crashes with the following error.

    The process cannot access the file generated.cs because it is being used by another process.
    

    To resume, I have to clear out the models builder folder and run dontnet watch again to regenerate all of the models.

    Is there a way around this?

    Thanks

    Tony

  • Thomas 316 posts 603 karma points c-trib
    Jun 01, 2022 @ 13:13
    Thomas
    0

    Did you find at fix for this ?

  • Per Bolmstedt 84 posts 380 karma points
    Jun 03, 2022 @ 12:24
    Per Bolmstedt
    0

    What is the point of using dotnet watch here? Is it when you don't use Visual Studio for development, to get automatic recompilation? Don't really see how it could avoid restarting the site if it recompiles.

Please Sign in or register to post replies

Write your reply to:

Draft