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

[BUG] New Visual Studio (17.5 afterwards) build acceleration breaks Oqtane Module build process #4103

Closed
mdmontesinos opened this issue Apr 4, 2024 · 8 comments · Fixed by #4112

Comments

@mdmontesinos
Copy link
Contributor

Oqtane Info

Version - 5.1.0
Render Mode - Static
Interactivity - Server
Database - SQL Server

Describe the bug

I just updated Visual Studio to latest version (17.9.5) and it seems they added build acceleration that when building a module solution gives this message:

image

This feature is enabled by default. However, this also prevents the Module.Package project from being rebuilt, as it doesn't detect changes in it even though I changed the Client or Server projects. Therefore, the PostBuild commands that should be executed to copy the module assemblies to Oqtane do not get triggered and the updated assemblies are not copied.

Expected Behavior

The Package project should always be rebuilt to trigger commands to copy module assemblies to Oqtane.

Steps To Reproduce

Upgrade Visual Studio to version 17.9.5 and try to rebuild and see the changes made on a module.

Anything else?

The issue can be solved by disabling Build Acceleration in the Package project

<PropertyGroup>
	<TargetFramework>net8.0</TargetFramework>
	<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
	<AccelerateBuildsInVisualStudio>false</AccelerateBuildsInVisualStudio>
</PropertyGroup>
@sbwalker sbwalker changed the title [BUG] New Visual Studio (17.5 afterwards) build acceleration breaks Oqtane build process [BUG] New Visual Studio (17.5 afterwards) build acceleration breaks Oqtane Module build process Apr 4, 2024
@sbwalker
Copy link
Member

sbwalker commented Apr 4, 2024

@mdmontesinos does it make any difference if you use Rebuild Solution vs Build Solution? In my experience, Build Solution would fail to recognize when changes were made... however Rebuild Solution always does a full build.

image

@mdmontesinos
Copy link
Contributor Author

Rebuild solution in my module solution usually fails for me, as it seems to delete some Oqtane DLLs that can't be rebuilt by it. I then need to open the Oqtane solution and rebuild it first to get it working.

Build solution is faster, has a keyboard shortcut and almost acts as a "hot reload".

Anyway, the solution I proposed seems to fix the issue, but I'm not entirely sure if the other projects (Client, Server, ...) are being "build accelerated" or if it's disabled for the entire module solution.

@leigh-pointer
Copy link
Contributor

@mdmontesinos @sbwalker
I have upgraded to 17.5 built Release package with Build and Rebuild with no errors.
Examining the Package Project from the 5.1.0 templates, the AccelerateBuildsInVisualStudio property does not exist in both Module and Theme.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
  </PropertyGroup>

  <ItemGroup>
    <None Include="icon.png">
      <Pack>True</Pack>
      <PackagePath></PackagePath>
    </None>
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Client\[Owner].Module.[Module].Client.csproj" />
    <ProjectReference Include="..\Server\[Owner].Module.[Module].Server.csproj" />
    <ProjectReference Include="..\Shared\[Owner].Module.[Module].Shared.csproj" />
  </ItemGroup>

  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Condition="'$(OS)' == 'Windows_NT' And '$(Configuration)' == 'Debug'" Command="debug.cmd" />
    <Exec Condition="'$(OS)' != 'Windows_NT' And '$(Configuration)' == 'Debug'" Command="bash $(ProjectDir)debug.sh" />
    <Exec Condition="'$(OS)' == 'Windows_NT' And '$(Configuration)' == 'Release'" Command="release.cmd" />
    <Exec Condition="'$(OS)' != 'Windows_NT' And '$(Configuration)' == 'Release'" Command="bash $(ProjectDir)release.sh" />
  </Target>

</Project>

@mdmontesinos
Copy link
Contributor Author

mdmontesinos commented Apr 5, 2024

@leigh-pointer I manually added the AccelerateBuildsInVisualStudio property in my module package project to solve the issue.

It does not throw any errors, it's just not copying the updated module assemblies in Oqtane (in debug mode, not in release)

@sbwalker
Copy link
Member

sbwalker commented Apr 5, 2024

@mdmontesinos "Rebuild solution in my module solution usually fails for me, as it seems to delete some Oqtane DLLs that can't be rebuilt by it. I then need to open the Oqtane solution and rebuild it first to get it working."

This was an issue in older versions of the default module template - but it was fixed. The fix was that the Oqtane.Server project in the solution had to be identified to Not Build (you will notice in a new module which is scaffolded using Create Module in Module Management that the solution file does not contain any "CPU.Build.0" entries for the Oqtane.Server project).

You can accomplish the same thing manually by changing the Configuration Manager (in Builld menu in VS):

image

This allows you to do a Build / Rebuild without affecting the Oqtane Framework.

@mdmontesinos
Copy link
Contributor Author

Thanks for that fix, it also speeds up a bit the building process and therefore, the development speed.

As for the Rebuild Solution, it does ignore the Accelerate Build and copies the updated assemblies. However, it is still slower than building the solution with the AccelerateBuildsInVisualStudio=false for the Package project while maintaining it for the rest of the projects. Rebuild Solution always builds all the projects, while Build Solution always builds the Package project, but only builds the modified ones.

@sbwalker
Copy link
Member

sbwalker commented Apr 5, 2024

@mdmontesinos if the AccelerateBuildsInVisualStudio property helps to avoid issues for developers, please submit a PR for the default module template files where it needs to be added.

@mdmontesinos
Copy link
Contributor Author

I just submitted it. Also modified the Theme template, as it would be affected in the same way.

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