diff --git a/powershell/generators/csproj.ts b/powershell/generators/csproj.ts index 1f7fe25278..e06535a328 100644 --- a/powershell/generators/csproj.ts +++ b/powershell/generators/csproj.ts @@ -15,6 +15,22 @@ export async function generateCsproj(project: Project) { TRACE;RELEASE;NETSTANDARD;SIGN` : ' TRACE;RELEASE;NETSTANDARD'; + const assemblyinfo = project.azure ? ` + ${project.assemblyInfoPath} + ${project.assemblyCompany} + ${project.assemblyProduct} + ${project.assemblyCopyright} + ${project.assemblyProduct} - ${project.title} + + + + <_Parameter1>false + + + <_Parameter1>false + + ` : ''; + project.state.writeFile(project.csproj, ` @@ -36,7 +52,7 @@ export async function generateCsproj(project: Project) { true - + ${assemblyinfo} false TRACE;DEBUG;NETSTANDARD diff --git a/powershell/generators/gitignore.ts b/powershell/generators/gitignore.ts index d4dd530ff8..783cae2547 100644 --- a/powershell/generators/gitignore.ts +++ b/powershell/generators/gitignore.ts @@ -17,7 +17,9 @@ tools custom/*.psm1 custom/autogen-model-cmdlets test/*-TestResults.xml +license.txt /*.ps1 +/*.psd1 /*.ps1xml /*.psm1 /*.snk diff --git a/powershell/internal/project.ts b/powershell/internal/project.ts index 1748c67d10..73fa47f737 100644 --- a/powershell/internal/project.ts +++ b/powershell/internal/project.ts @@ -123,6 +123,7 @@ export class Project extends codeDomProject { public pwshCommentHeader!: string; public pwshCommentHeaderForCsharp!: string; public csharpCommentHeader!: string; + public csharpCommentHeaderForCsharp!: string; public cmdletFolder!: string; public modelCmdletFolder!: string; public endpointResourceIdKeyName!: string; @@ -142,6 +143,7 @@ export class Project extends codeDomProject { public uxFolder!: string; public serviceName!: string; public moduleName!: string; + public title!: string; public rootModuleName!: string; public csproj!: string; public nuspec!: string; @@ -151,6 +153,10 @@ export class Project extends codeDomProject { public readme!: string; public afterBuildTasksPath!: string; public afterBuildTasksArgs!: string; + public assemblyInfoPath!: string; + public assemblyCompany!: string; + public assemblyProduct!: string; + public assemblyCopyright!: string; public dllName!: string; public dll!: string; public psd1!: string; @@ -262,6 +268,7 @@ export class Project extends codeDomProject { : this.license, '//' ); + this.csharpCommentHeaderForCsharp = this.csharpCommentHeader.replace(/"/g, '""'); // modelcmdlets are models that we will create cmdlets for. this.modelCmdlets = []; @@ -284,6 +291,7 @@ export class Project extends codeDomProject { this.serviceName = this.model.language.default.serviceName; this.subjectPrefix = this.model.language.default.subjectPrefix; this.moduleName = await this.state.getValue('module-name'); + this.title = await this.state.getValue('title'); this.rootModuleName = await this.state.getValue('root-module-name', ''); this.dllName = await this.state.getValue('dll-name'); // Azure PowerShell data plane configuration @@ -340,6 +348,11 @@ export class Project extends codeDomProject { const afterBuildTasksArgsDictionary: Dictionary = await this.state.getValue>('after-build-tasks-args', {}); this.afterBuildTasksArgs = JSON.stringify(afterBuildTasksArgsDictionary); + this.assemblyInfoPath = await this.state.getValue('assemblyInfo-path', ''); + this.assemblyCompany = await this.state.getValue('assembly-company', ''); + this.assemblyProduct = await this.state.getValue('assembly-product', ''); + this.assemblyCopyright = await this.state.getValue('assembly-copyright', ''); + // excluded properties in table view const excludedList = >( values( @@ -423,4 +436,4 @@ export class Project extends codeDomProject { private convertToPsListAsString(items: Array): string { return items ? items.map((i) => `'${i}'`).join(', ') : 'undefined'; } -} +} \ No newline at end of file diff --git a/powershell/resources/assets/build-module.ps1 b/powershell/resources/assets/build-module.ps1 index 085952e226..f38945fc69 100644 --- a/powershell/resources/assets/build-module.ps1 +++ b/powershell/resources/assets/build-module.ps1 @@ -64,6 +64,8 @@ if(-not $NotIsolated -and -not $Debugger) { $binFolder = Join-Path $PSScriptRoot '${$lib.path.relative($project.baseFolder, $project.binFolder)}' $objFolder = Join-Path $PSScriptRoot '${$lib.path.relative($project.baseFolder, $project.objFolder)}' +$isAzure = [System.Convert]::ToBoolean('${$project.azure}') + if(-not $Debugger) { Write-Host -ForegroundColor Green 'Cleaning build folders...' $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path $binFolder, $objFolder @@ -86,6 +88,13 @@ if(-not $Debugger) { $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path (Join-Path $binFolder 'Debug'), (Join-Path $binFolder 'Release') } +if ($isAzure -And '${$project.assemblyInfoPath}') { + $assemblyInfoPath = Join-Path $PSScriptRoot '${$project.assemblyInfoPath}' + $header = '${$project.csharpCommentHeaderForCsharp}' + $content = $header + [Environment]::NewLine + [Environment]::NewLine + (Get-Content $assemblyInfoPath -Raw) + $content | Set-Content $assemblyInfoPath -Force +} + $dll = Join-Path $PSScriptRoot '${$lib.path.relative($project.baseFolder, $project.dll)}' if(-not (Test-Path $dll)) { Write-Error "Unable to find output assembly in '$binFolder'." @@ -140,7 +149,7 @@ if($NoDocs) { $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue } $null = New-Item -ItemType Directory -Force -Path $docsFolder - $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('${$project.azure}') + $addComplexInterfaceInfo = !$isAzure Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo } @@ -175,5 +184,4 @@ if (-not $DisableAfterBuildTasks){ } } - -Write-Host -ForegroundColor Green '-------------Done-------------' +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file