Closed abatishchev closed 11 months ago
Here's what I found:
If my project includes only the main file:
<ItemGroup>
<Bicep Include="main.bicep" OutputFile="ServiceGroupRoot\Templates\resources.json" />
</ItemGroup>
Athen build/MSBuild/VS doesn't detect any changes in other Bicep files, e.g. modules.
But if it includes all files like this:
<ItemGroup>
<Bicep Include="*.bicep" OutputFile="ServiceGroupRoot\Templates\%(RecursiveDir)\%(FileName).json" />
</ItemGroup>
Then it does detect the changes any of the files but then generates a separate ARM template per each module, what's not what I need.
I think the issue is that we need to update our MSBuild package to provide a hint to Visual Studio not to skip the project. VS runs its own heuristics to determine whether a project has changed and they are different from MSBuild's.
You add this to your project and it should start behaving normally:
<ItemGroup>
<AvailableItemName Include="Bicep" />
</ItemGroup>
This will also cause *.bicep files to show up in Solution Explorer in VS. I'm going to add this to our target files as well.
Here's my Resources.msbuildproject file:
With the following folder structure:
In order for the output files to be recompiled and rewritten, I have to delete them. Otherwise building from VS does nothing:
Environment: