Skip to content

Commit

Permalink
Fix duplicate classIDs for different builds (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
EricJohnson327 authored Jul 23, 2024
1 parent 80f08ee commit 7373819
Show file tree
Hide file tree
Showing 9 changed files with 436 additions and 68 deletions.
2 changes: 1 addition & 1 deletion build/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ parameters:
- release

variables:
MSIXVersion: '0.1100'
MSIXVersion: '0.1200'
solution: '**/DevHomeAzureExtension.sln'
appxPackageDir: 'AppxPackages'
testOutputArtifactDir: 'TestResults'
Expand Down
64 changes: 3 additions & 61 deletions build/scripts/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,63 +62,22 @@ $ErrorActionPreference = "Stop"
Try {
if (($BuildStep -ieq "all") -Or ($BuildStep -ieq "msix")) {
$buildRing = "Dev"
$newPackageName = $null
$newPackageDisplayName = $null
$newAppDisplayNameResource = $null
$newWidgetProviderDisplayName = $null
$appxmanifestPath = (Join-Path $env:Build_RootDirectory "src\AzureExtensionServer\Package-Dev.appxmanifest")

if ($AzureBuildingBranch -ieq "release") {
$buildRing = "Stable"
$newPackageName = "Microsoft.Windows.DevHomeAzureExtension"
$newPackageDisplayName = "Dev Home Azure Extension (Preview)"
$newAppDisplayNameResource = "ms-resource:AppDisplayNameStable"
$newWidgetProviderDisplayName = "ms-resource:WidgetProviderDisplayNameStable"
$appxmanifestPath = (Join-Path $env:Build_RootDirectory "src\AzureExtensionServer\Package.appxmanifest")
} elseif ($AzureBuildingBranch -ieq "staging") {
$buildRing = "Canary"
$newPackageName = "Microsoft.Windows.DevHomeAzureExtension.Canary"
$newPackageDisplayName = "Dev Home Azure Extension (Canary)"
$newAppDisplayNameResource = "ms-resource:AppDisplayNameCanary"
$newWidgetProviderDisplayName = "ms-resource:WidgetProviderDisplayNameCanary"
$appxmanifestPath = (Join-Path $env:Build_RootDirectory "src\AzureExtensionServer\Package-Can.appxmanifest")
}

[Reflection.Assembly]::LoadWithPartialName("System.Xml.Linq")
$xIdentity = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Identity");
$xProperties = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Properties");
$xDisplayName = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}DisplayName");
$xApplications = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Applications");
$xApplication = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Application");
$uapVisualElements = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/uap/windows10}VisualElements");
$xExtensions = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Extensions");
$uapExtension = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/uap/windows10/3}Extension");
$uapAppExtension = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/uap/windows10/3}AppExtension");

# Update the appxmanifest
$appxmanifestPath = (Join-Path $env:Build_RootDirectory "src\AzureExtensionServer\Package.appxmanifest")
$appxmanifest = [System.Xml.Linq.XDocument]::Load($appxmanifestPath)
$appxmanifest.Root.Element($xIdentity).Attribute("Version").Value = $env:msix_version
if (-not ([string]::IsNullOrEmpty($newPackageName))) {
$appxmanifest.Root.Element($xIdentity).Attribute("Name").Value = $newPackageName
}
if (-not ([string]::IsNullOrEmpty($newPackageDisplayName))) {
$appxmanifest.Root.Element($xProperties).Element($xDisplayName).Value = $newPackageDisplayName
}
if (-not ([string]::IsNullOrEmpty($newAppDisplayNameResource))) {
$appxmanifest.Root.Element($xApplications).Element($xApplication).Element($uapVisualElements).Attribute("DisplayName").Value = $newAppDisplayNameResource
$extensions = $appxmanifest.Root.Element($xApplications).Element($xApplication).Element($xExtensions).Elements($uapExtension)
foreach ($extension in $extensions) {
if ($extension.Attribute("Category").Value -eq "windows.appExtension") {
$appExtension = $extension.Element($uapAppExtension)
switch ($appExtension.Attribute("Name").Value) {
"com.microsoft.devhome" {
$appExtension.Attribute("DisplayName").Value = $newAppDisplayNameResource
}
"com.microsoft.windows.widgets" {
$appExtension.Attribute("DisplayName").Value = $newWidgetProviderDisplayName
}
}
}
}
}
$appxmanifest.Save($appxmanifestPath)

foreach ($platform in $env:Build_Platform.Split(",")) {
Expand Down Expand Up @@ -148,23 +107,6 @@ Try {
# Reset the appxmanifest to prevent unnecessary code changes
$appxmanifest = [System.Xml.Linq.XDocument]::Load($appxmanifestPath)
$appxmanifest.Root.Element($xIdentity).Attribute("Version").Value = "0.0.0.0"
$appxmanifest.Root.Element($xIdentity).Attribute("Name").Value = "Microsoft.Windows.DevHomeAzureExtension.Dev"
$appxmanifest.Root.Element($xProperties).Element($xDisplayName).Value = "Dev Home Azure Extension (Dev)"
$appxmanifest.Root.Element($xApplications).Element($xApplication).Element($uapVisualElements).Attribute("DisplayName").Value = "ms-resource:AppDisplayNameDev"
$extensions = $appxmanifest.Root.Element($xApplications).Element($xApplication).Element($xExtensions).Elements($uapExtension)
foreach ($extension in $extensions) {
if ($extension.Attribute("Category").Value -eq "windows.appExtension") {
$appExtension = $extension.Element($uapAppExtension)
switch ($appExtension.Attribute("Name").Value) {
"com.microsoft.devhome" {
$appExtension.Attribute("DisplayName").Value = "ms-resource:AppDisplayNameDev"
}
"com.microsoft.windows.widgets" {
$appExtension.Attribute("DisplayName").Value = "ms-resource:WidgetProviderDisplayNameDev"
}
}
}
}
$appxmanifest.Save($appxmanifestPath)
}

Expand Down
2 changes: 1 addition & 1 deletion build/scripts/CreateBuildInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Param(
)

$Major = "0"
$Minor = "11"
$Minor = "12"
$Patch = "99" # default to 99 for local builds

$versionSplit = $Version.Split(".");
Expand Down
6 changes: 6 additions & 0 deletions src/AzureExtension/AzureExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
namespace DevHomeAzureExtension;

[ComVisible(true)]
#if CANARY_BUILD
[Guid("0F3605DE-92CF-4FE0-9BCD-A3519EA67D1B")]
#elif STABLE_BUILD
[Guid("182AF84F-D5E1-469C-9742-536EFEA94630")]
#else
[Guid("28A2AB40-26EA-48BF-A8BC-49FEC9B7C18C")]
#endif
[ComDefaultInterface(typeof(IExtension))]
public sealed class AzureExtension : IExtension
{
Expand Down
6 changes: 6 additions & 0 deletions src/AzureExtension/Widgets/WidgetProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ namespace DevHomeAzureExtension.Widgets;

[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
#if CANARY_BUILD
[Guid("5C844D91-B497-4D59-AE73-CDC895B1EB2F")]
#elif STABLE_BUILD
[Guid("B91B13BB-B3B4-4F2E-9EF9-554757F33E1C")]
#else
[Guid("1A7EFA8B-2CFA-4130-93B0-92BC0230C84E")]
#endif
public sealed class WidgetProvider : IWidgetProvider, IWidgetProvider2
{
private readonly ILogger _log = Log.ForContext("SourceContext", nameof(WidgetProvider));
Expand Down
18 changes: 18 additions & 0 deletions src/AzureExtensionServer/AzureExtensionServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@
<Folder Include="Assets\" />
</ItemGroup>

<ItemGroup Condition="'$(BuildRing)' == 'Dev'">
<AppxManifest Include="Package-Dev.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>

<ItemGroup Condition="'$(BuildRing)' == 'Canary'">
<AppxManifest Include="Package-Can.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>

<ItemGroup Condition="'$(BuildRing)' == 'Stable'">
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
Expand Down
198 changes: 198 additions & 0 deletions src/AzureExtensionServer/Package-Can.appxmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:genTemplate="http://schemas.microsoft.com/appx/developer/templatestudio" xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" IgnorableNamespaces="uap uap3 rescap genTemplate">
<Identity Name="Microsoft.Windows.DevHomeAzureExtension.Can" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="0.0.0.0" />
<Properties>
<DisplayName>Dev Home Azure Extension (Can)</DisplayName>
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22000.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="DevHomeAzureExtension.exe" EntryPoint="$targetentrypoint$">
<uap:VisualElements DisplayName="ms-resource:AppDisplayNameCanary" Description="ms-resource:AppDescription" AppListEntry="none" BackgroundColor="transparent" Square150x150Logo="Assets\MedTile.png" Square44x44Logo="Assets\AppList.png">
<uap:DefaultTile Wide310x150Logo="Assets\WideTile.png" />
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:ExeServer Executable="DevHomeAzureExtension.exe" Arguments="-RegisterProcessAsComServer" DisplayName="Azure Provider Widget">
<com:Class Id="5C844D91-B497-4D59-AE73-CDC895B1EB2F" DisplayName="Azure Provider Widget" />
</com:ExeServer>
</com:ComServer>
</com:Extension>
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:ExeServer Executable="DevHomeAzureExtension.exe" Arguments="-RegisterProcessAsComServer" DisplayName="Azure Extension Provider">
<com:Class Id="0F3605DE-92CF-4FE0-9BCD-A3519EA67D1B" DisplayName="Azure Extension Provider" />
</com:ExeServer>
</com:ComServer>
</com:Extension>
<uap3:Extension Category="windows.appExtension">
<uap3:AppExtension Name="com.microsoft.devhome" Id="PG-SP-ID" PublicFolder="Public" DisplayName="ms-resource:AppDisplayNameCanary" Description="ms-resource:AppDescription">
<uap3:Properties>
<DevHomeProvider>
<Activation>
<CreateInstance ClassId="0F3605DE-92CF-4FE0-9BCD-A3519EA67D1B" />
</Activation>
<SupportedInterfaces>
<DeveloperId />
<Repository />
<ComputeSystem />
<QuickStartProject />
<Settings />
</SupportedInterfaces>
</DevHomeProvider>
</uap3:Properties>
</uap3:AppExtension>
</uap3:Extension>
<desktop:Extension Category="windows.toastNotificationActivation">
<desktop:ToastNotificationActivation ToastActivatorCLSID="9DC0FB0C-D352-4195-8BFC-A82494C5977F" />
</desktop:Extension>
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:ExeServer Executable="DevHomeAzureExtension.exe" Arguments="----AppNotificationActivated:" DisplayName="DevHome Azure Extension Toast Activator">
<com:Class Id="9DC0FB0C-D352-4195-8BFC-A82494C5977F" DisplayName="DevHome Azure Extension Toast Activator" />
</com:ExeServer>
</com:ComServer>
</com:Extension>
<uap3:Extension Category="windows.appExtension">
<uap3:AppExtension Name="com.microsoft.windows.widgets" DisplayName="ms-resource:WidgetProviderDisplayNameCanary" Id="01" PublicFolder="Public">
<uap3:Properties>
<WidgetProvider>
<ProviderIcons>
<Icon Path="Assets\StoreLogo.scale-100.png" />
</ProviderIcons>
<Activation>
<!-- Apps exports COM interface which implements IWidgetProvider -->
<CreateInstance ClassId="5C844D91-B497-4D59-AE73-CDC895B1EB2F" />
</Activation>
<Definitions>
<Definition Id="Azure_QueryList" DisplayName="Query Result" Description="Azure Query List Widget" IsCustomizable="true">
<Capabilities>
<Capability>
<Size Name="small" />
</Capability>
<Capability>
<Size Name="medium" />
</Capability>
<Capability>
<Size Name="large" />
</Capability>
</Capabilities>
<ThemeResources>
<Icons>
<Icon Path="Widgets\Assets\azureIcon.png" />
</Icons>
<Screenshots>
<Screenshot Path="Widgets\Assets\QueryResultScreenshotLight.png" DisplayAltText="Dev Home icon" />
</Screenshots>
<DarkMode>
<Icons>
<Icon Path="Widgets\Assets\azureIcon.png" />
</Icons>
<Screenshots>
<Screenshot Path="Widgets\Assets\QueryResultScreenshotDark.png" DisplayAltText="Dev Home icon" />
</Screenshots>
</DarkMode>
<LightMode>
<Icons>
<Icon Path="Widgets\Assets\azureIcon.png" />
</Icons>
<Screenshots>
<Screenshot Path="Widgets\Assets\QueryResultScreenshotLight.png" DisplayAltText="Dev Home icon" />
</Screenshots>
</LightMode>
</ThemeResources>
</Definition>
<Definition Id="Azure_QueryTiles" DisplayName="Query Tiles" Description="Azure DevOps Query Tiles Widget" IsCustomizable="true">
<Capabilities>
<Capability>
<Size Name="small" />
</Capability>
<Capability>
<Size Name="medium" />
</Capability>
<Capability>
<Size Name="large" />
</Capability>
</Capabilities>
<ThemeResources>
<Icons>
<Icon Path="Widgets\Assets\azureIcon.png" />
</Icons>
<Screenshots>
<Screenshot Path="Widgets\Assets\QueryTilesScreenshotLight.png" DisplayAltText="Dev Home icon" />
</Screenshots>
<DarkMode>
<Icons>
<Icon Path="Widgets\Assets\azureIcon.png" />
</Icons>
<Screenshots>
<Screenshot Path="Widgets\Assets\QueryTilesScreenshotDark.png" DisplayAltText="Dev Home icon" />
</Screenshots>
</DarkMode>
<LightMode>
<Icons>
<Icon Path="Widgets\Assets\azureIcon.png" />
</Icons>
<Screenshots>
<Screenshot Path="Widgets\Assets\QueryTilesScreenshotLight.png" DisplayAltText="Dev Home icon" />
</Screenshots>
</LightMode>
</ThemeResources>
</Definition>
<Definition Id="Azure_PullRequests" DisplayName="Pull Requests" Description="Azure DevOps Pull Requests Widget" IsCustomizable="true">
<Capabilities>
<Capability>
<Size Name="small" />
</Capability>
<Capability>
<Size Name="medium" />
</Capability>
<Capability>
<Size Name="large" />
</Capability>
</Capabilities>
<ThemeResources>
<Icons>
<Icon Path="Widgets\Assets\azureIcon.png" />
</Icons>
<Screenshots>
<Screenshot Path="Widgets\Assets\PullRequestsScreenshotLight.png" DisplayAltText="Dev Home icon" />
</Screenshots>
<DarkMode>
<Icons>
<Icon Path="Widgets\Assets\azureIcon.png" />
</Icons>
<Screenshots>
<Screenshot Path="Widgets\Assets\PullRequestsScreenshotDark.png" DisplayAltText="Dev Home icon" />
</Screenshots>
</DarkMode>
<LightMode>
<Icons>
<Icon Path="Widgets\Assets\azureIcon.png" />
</Icons>
<Screenshots>
<Screenshot Path="Widgets\Assets\PullRequestsScreenshotLight.png" DisplayAltText="Dev Home icon" />
</Screenshots>
</LightMode>
</ThemeResources>
</Definition>
</Definitions>
</WidgetProvider>
</uap3:Properties>
</uap3:AppExtension>
</uap3:Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>
Loading

0 comments on commit 7373819

Please sign in to comment.