mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
fix: Resolve MSIX template field reference errors in wails3 init
This fixes the template execution errors that occurred when running 'wails3 init' with MSIX-related templates. The issue was that the templates were trying to access fields under an 'Info' sub-struct that doesn't exist in the BuildConfig context. Changes: - Fixed app_manifest.xml.tmpl to use direct field references (e.g., .ProductIdentifier instead of .Info.ProductIdentifier) - Fixed template.xml.tmpl with the same field reference corrections - Added missing MSIX-related fields to BuildAssetsOptions struct (Publisher, ProcessorArchitecture, ExecutablePath, ExecutableName, OutputPath, CertificatePath) - Set appropriate default values for the new fields in GenerateBuildAssets function Resolves the error: "can't evaluate field Info in type commands.BuildConfig" 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
01ed7affc9
commit
a55c1fedcb
3 changed files with 57 additions and 29 deletions
|
|
@ -31,9 +31,15 @@ type BuildAssetsOptions struct {
|
|||
ProductCompany string `description:"The company of the product" default:"My Company"`
|
||||
ProductCopyright string `description:"The copyright notice" default:"\u00a9 now, My Company"`
|
||||
ProductComments string `description:"Comments to add to the generated files" default:"This is a comment"`
|
||||
ProductIdentifier string `description:"The product identifier, e.g com.mycompany.myproduct"`
|
||||
Silent bool `description:"Suppress output to console"`
|
||||
Typescript bool `description:"Use typescript" default:"false"`
|
||||
ProductIdentifier string `description:"The product identifier, e.g com.mycompany.myproduct"`
|
||||
Publisher string `description:"Publisher name for MSIX package (e.g., CN=CompanyName)"`
|
||||
ProcessorArchitecture string `description:"Processor architecture for MSIX package" default:"x64"`
|
||||
ExecutablePath string `description:"Path to executable for MSIX package"`
|
||||
ExecutableName string `description:"Name of executable for MSIX package"`
|
||||
OutputPath string `description:"Output path for MSIX package"`
|
||||
CertificatePath string `description:"Certificate path for MSIX package"`
|
||||
Silent bool `description:"Suppress output to console"`
|
||||
Typescript bool `description:"Use typescript" default:"false"`
|
||||
}
|
||||
|
||||
type BuildConfig struct {
|
||||
|
|
@ -90,6 +96,28 @@ func GenerateBuildAssets(options *BuildAssetsOptions) error {
|
|||
}
|
||||
}
|
||||
|
||||
if options.Publisher == "" {
|
||||
options.Publisher = fmt.Sprintf("CN=%s", options.ProductCompany)
|
||||
}
|
||||
|
||||
if options.ProcessorArchitecture == "" {
|
||||
options.ProcessorArchitecture = "x64"
|
||||
}
|
||||
|
||||
if options.ExecutableName == "" {
|
||||
options.ExecutableName = options.BinaryName
|
||||
}
|
||||
|
||||
if options.ExecutablePath == "" {
|
||||
options.ExecutablePath = options.BinaryName
|
||||
}
|
||||
|
||||
if options.OutputPath == "" {
|
||||
options.OutputPath = fmt.Sprintf("%s.msix", normaliseName(options.Name))
|
||||
}
|
||||
|
||||
// CertificatePath is optional, no default needed
|
||||
|
||||
config.BuildAssetsOptions = *options
|
||||
|
||||
tfs, err := fs.Sub(buildAssets, "build_assets")
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@
|
|||
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10">
|
||||
|
||||
<Identity
|
||||
Name="{{.Info.ProductIdentifier}}"
|
||||
Name="{{.ProductIdentifier}}"
|
||||
Publisher="{{.Publisher}}"
|
||||
Version="{{.Info.Version}}.0"
|
||||
Version="{{.ProductVersion}}.0"
|
||||
ProcessorArchitecture="{{.ProcessorArchitecture}}" />
|
||||
|
||||
<Properties>
|
||||
<DisplayName>{{.Info.ProductName}}</DisplayName>
|
||||
<PublisherDisplayName>{{.Info.CompanyName}}</PublisherDisplayName>
|
||||
<Description>{{.Info.Description}}</Description>
|
||||
<DisplayName>{{.ProductName}}</DisplayName>
|
||||
<PublisherDisplayName>{{.ProductCompany}}</PublisherDisplayName>
|
||||
<Description>{{.ProductDescription}}</Description>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
|
|
@ -27,10 +27,10 @@
|
|||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="{{.Info.ProductIdentifier}}" Executable="{{.ExecutableName}}" EntryPoint="Windows.FullTrustApplication">
|
||||
<Application Id="{{.ProductIdentifier}}" Executable="{{.BinaryName}}" EntryPoint="Windows.FullTrustApplication">
|
||||
<uap:VisualElements
|
||||
DisplayName="{{.Info.ProductName}}"
|
||||
Description="{{.Info.Description}}"
|
||||
DisplayName="{{.ProductName}}"
|
||||
Description="{{.ProductDescription}}"
|
||||
BackgroundColor="transparent"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png">
|
||||
|
|
@ -39,13 +39,13 @@
|
|||
</uap:VisualElements>
|
||||
|
||||
<Extensions>
|
||||
<desktop:Extension Category="windows.fullTrustProcess" Executable="{{.ExecutableName}}" />
|
||||
<desktop:Extension Category="windows.fullTrustProcess" Executable="{{.BinaryName}}" />
|
||||
{{if .FileAssociations}}
|
||||
<uap:Extension Category="windows.fileTypeAssociation">
|
||||
<uap:FileTypeAssociation Name="{{.Info.ProductIdentifier}}">
|
||||
<uap:DisplayName>{{.Info.ProductName}}</uap:DisplayName>
|
||||
<uap:FileTypeAssociation Name="{{.ProductIdentifier}}">
|
||||
<uap:DisplayName>{{.ProductName}}</uap:DisplayName>
|
||||
<uap:Logo>Assets\FileIcon.png</uap:Logo>
|
||||
<uap:InfoTip>{{.Info.ProductName}} File</uap:InfoTip>
|
||||
<uap:InfoTip>{{.ProductName}} File</uap:InfoTip>
|
||||
<uap:SupportedFileTypes>
|
||||
{{range .FileAssociations}}
|
||||
<uap:FileType>.{{.Ext}}</uap:FileType>
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@
|
|||
<Installer
|
||||
Path="{{.ExecutablePath}}"
|
||||
Arguments=""
|
||||
InstallLocation="C:\Program Files\{{.Info.CompanyName}}\{{.Info.ProductName}}">
|
||||
InstallLocation="C:\Program Files\{{.ProductCompany}}\{{.ProductName}}">
|
||||
</Installer>
|
||||
<PackageInformation
|
||||
PackageName="{{.Info.ProductName}}"
|
||||
PackageDisplayName="{{.Info.ProductName}}"
|
||||
PublisherName="CN={{.Info.CompanyName}}"
|
||||
PublisherDisplayName="{{.Info.CompanyName}}"
|
||||
Version="{{.Info.Version}}.0"
|
||||
PackageDescription="{{.Info.Description}}">
|
||||
PackageName="{{.ProductName}}"
|
||||
PackageDisplayName="{{.ProductName}}"
|
||||
PublisherName="CN={{.ProductCompany}}"
|
||||
PublisherDisplayName="{{.ProductCompany}}"
|
||||
Version="{{.ProductVersion}}.0"
|
||||
PackageDescription="{{.ProductDescription}}">
|
||||
<Capabilities>
|
||||
<Capability Name="runFullTrust" />
|
||||
{{if .FileAssociations}}
|
||||
|
|
@ -27,15 +27,15 @@
|
|||
</Capabilities>
|
||||
<Applications>
|
||||
<Application
|
||||
Id="{{.Info.ProductIdentifier}}"
|
||||
Description="{{.Info.Description}}"
|
||||
DisplayName="{{.Info.ProductName}}"
|
||||
Id="{{.ProductIdentifier}}"
|
||||
Description="{{.ProductDescription}}"
|
||||
DisplayName="{{.ProductName}}"
|
||||
ExecutableName="{{.ExecutableName}}"
|
||||
EntryPoint="Windows.FullTrustApplication">
|
||||
{{if .FileAssociations}}
|
||||
<Extensions>
|
||||
<Extension Category="windows.fileTypeAssociation">
|
||||
<FileTypeAssociation Name="{{.Info.ProductIdentifier}}">
|
||||
<FileTypeAssociation Name="{{.ProductIdentifier}}">
|
||||
{{range .FileAssociations}}
|
||||
<SupportedFileTypes>
|
||||
<FileType>.{{.Ext}}</FileType>
|
||||
|
|
@ -55,9 +55,9 @@
|
|||
</Dependencies>
|
||||
<Properties>
|
||||
<Framework>false</Framework>
|
||||
<DisplayName>{{.Info.ProductName}}</DisplayName>
|
||||
<PublisherDisplayName>{{.Info.CompanyName}}</PublisherDisplayName>
|
||||
<Description>{{.Info.Description}}</Description>
|
||||
<DisplayName>{{.ProductName}}</DisplayName>
|
||||
<PublisherDisplayName>{{.ProductCompany}}</PublisherDisplayName>
|
||||
<Description>{{.ProductDescription}}</Description>
|
||||
<Logo>Assets\AppIcon.png</Logo>
|
||||
</Properties>
|
||||
</PackageInformation>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue