-
Notifications
You must be signed in to change notification settings - Fork 748
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
Azure.Bicep.MSBuild trying to use win-x64 bicep.exe on Mac #15228
Comments
Here is the <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Azure-Bicep-Version>0.30.23</Azure-Bicep-Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Bicep.CommandLine.linux-x64" Version="$(Azure-Bicep-Version)" />
<PackageReference Include="Azure.Bicep.CommandLine.osx-arm64" Version="$(Azure-Bicep-Version)" />
<PackageReference Include="Azure.Bicep.CommandLine.win-x64" Version="$(Azure-Bicep-Version)" />
<PackageReference Include="Azure.Bicep.MSBuild" Version="$(Azure-Bicep-Version)" />
</ItemGroup>
<ItemGroup>
<Bicep Include="**/*.bicep" OutputFile="%(RecursiveDir)/%(FileName)-template.json" />
</ItemGroup>
</Project> If I remove |
It also fails when run on Linux in CI:
|
On Linux, it tries and fails to use <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Azure-Bicep-Version>0.30.23</Azure-Bicep-Version>
<!-- Disable lock files as workaround for https://github.com/Azure/bicep/issues/15228 -->
<RestorePackagesWithLockFile>false</RestorePackagesWithLockFile>
<RestoreLockedMode>false</RestoreLockedMode>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Bicep.CommandLine.linux-x64" Version="$(Azure-Bicep-Version)" Condition="'$(OS)' == 'UNIX'" />
<PackageReference Include="Azure.Bicep.CommandLine.osx-arm64" Version="$(Azure-Bicep-Version)" Condition="'$(OS)' == 'UNIX'" />
<PackageReference Include="Azure.Bicep.CommandLine.win-x64" Version="$(Azure-Bicep-Version)" Condition="'$(OS)' == 'WINDOWS_NT'" />
<PackageReference Include="Azure.Bicep.MSBuild" Version="$(Azure-Bicep-Version)" />
</ItemGroup>
<ItemGroup>
<Bicep Include="**/*.bicep" OutputFile="%(RecursiveDir)/%(FileName)-template.json" />
</ItemGroup>
</Project>
|
The Azure.Bicep.CommandLine.* packages currently assume that only one flavor is referenced by a project so either the first or last one wins. I think we should be able to do our own OS detection and only run the logic from the package that matches the architecture of the machine running the build. Until we implement this fix, the best workaround is to set the |
@cataggar Does the workaround I shared help with this? |
@majastrz. The workaround was a bit more complicated than that. You can see in internal PR https://dev.azure.com/msazure/One/_git/Azure-Dedicated-AVS/pullrequest/10976497 . I had to disabled lock files and support for osx. We would like to be able to use lock files and have it work on Windows, Linux, and Mac. <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Azure-Bicep-Version>0.30.23</Azure-Bicep-Version>
<!-- Disable lock files as workaround for https://github.com/Azure/bicep/issues/15228 -->
<RestorePackagesWithLockFile>false</RestorePackagesWithLockFile>
<RestoreLockedMode>false</RestoreLockedMode>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Bicep.CommandLine.linux-x64" Version="$(Azure-Bicep-Version)" Condition="'$(OS)' == 'UNIX'" />
<!-- Also disable osx-arm64 for same workaround -->
<!-- <PackageReference Include="Azure.Bicep.CommandLine.osx-arm64" Version="$(Azure-Bicep-Version)" Condition="'$(OS)' == 'UNIX'" /> -->
<PackageReference Include="Azure.Bicep.CommandLine.win-x64" Version="$(Azure-Bicep-Version)" Condition="'$(OS)' == 'WINDOWS_NT'" />
<PackageReference Include="Azure.Bicep.MSBuild" Version="$(Azure-Bicep-Version)" />
</ItemGroup>
<ItemGroup>
<Bicep Include="**/*.bicep" OutputFile="%(RecursiveDir)/%(FileName).json" />
</ItemGroup>
</Project> |
I looked at the internal PR and that is definitely not a great experience. The platform/arch specific packages are basically just a way to set BicepPath. My fix will make the packages skip their logic unless the OS matches the package itself. |
We lock or dependencies and would like
dotnet build -t:BicepCompile
to work on Windows, Linux, and Mac. We are restoring all three native executable packages. It is just a little more disk space. The problem is that when I run it on my Mac, it is trying to run thewin-x64
build ofbicep.exe
. Seems like a bug.The text was updated successfully, but these errors were encountered: