WiX Light can't find a downloaded github actions artifact - github

In one step of a github actions job, I download an artifact that was uploaded in a previous job. I see these messages in the workflow output:
Artifact Executable_file was downloaded to D:\a\pcm_pcmplatinum_u\pcm_pcmplatinum_u\PCMateSetup\PCMPLUS.exe
Artifact download has finished successfully
In a subsequent step of the same job, I run msbuild on a *.wixproj file. Candle runs without error, but Light fails with this error:
error LGHT0103: The system cannot find the file 'D:\a\pcm_pcmplatinum_u\pcm_pcmplatinum_u\PCMateSetup\.\PCMPLUS.exe'.
Here are the relevant sections of the workflow .yml file:
- name: Download executable file
uses: actions/download-artifact#v3
with:
name: Executable_file
path: ./PCMateSetup/PCMPLUS.exe
- name: Build PCMateSetup
run: |
msbuild /m /p:MajorVer="${{env.majVer}}" /p:MinorVer="${{env.minVer}}" /p:BuildVer="${{env.bldVer}}" /p:ProtoVer="0" /p:GithubBld="true" /p:Configuration=${{env.BUILD_CONFIGURATION}} /v:n ${{env.SOLUTION_FILE_PATH}}\PCMateSetup\PCMateSetup.wixproj
From the .wxs files:
<?define PCMPlus.TargetDir="$(var.ProjectDir)." ?>
<File Id="file.instDir.PCMPLUSExecutable" Vital="yes" Source="$(var.PCMPlus.TargetDir)\PCMPLUS.exe" KeyPath="yes" />
And also from the output messages:
ProjectDir: D:\a\pcm_pcmplatinum_u\pcm_pcmplatinum_u\PCMateSetup\
I see no reason why Light should be failing this way. I did try changing the WiX code to eliminate the extra backslash and period in the path to the file, but Light failed with the same error. Does anyone have any idea why Light is failing to find the file? Thanks.

In one path it's PCMateSetup and in the other path it's PCMateSetup.

Related

Actions dont copy the entire subfolder

I was trying to build my soultion using msbuild and using follow ing workflow
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: ./genshincheat.sln
# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release
permissions:
contents: read
jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/checkout#v2
with:
submodules: true
- uses: actions/setup-dotnet#v1
- name: Build
run: dotnet build
- name: Run tests
run: dotnet test
The problem comes when the msbuild command runs :-
Build FAILED.
D:\a\genshin-cheat\genshin-cheat\injector\injector.vcxproj : warning NU1503: Skipping restore for project 'D:\a\genshin-cheat\genshin-cheat\injector\injector.vcxproj'. The project file may be invalid or missing targets required for restore. [D:\a\genshin-cheat\genshin-cheat\genshincheat.sln]
D:\a\genshin-cheat\genshin-cheat\cheat-base\cheat-base.vcxproj : warning NU1503: Skipping restore for project 'D:\a\genshin-cheat\genshin-cheat\cheat-base\cheat-base.vcxproj'. The project file may be invalid or missing targets required for restore. [D:\a\genshin-cheat\genshin-cheat\genshincheat.sln]
D:\a\genshin-cheat\genshin-cheat\cheat-library\cheat-library.vcxproj : warning NU1503: Skipping restore for project 'D:\a\genshin-cheat\genshin-cheat\cheat-library\cheat-library.vcxproj'. The project file may be invalid or missing targets required for restore. [D:\a\genshin-cheat\genshin-cheat\genshincheat.sln]
C:\Program Files\dotnet\sdk\6.0.202\NuGet.targets(130,5): warning : Unable to find a project to restore! [D:\a\genshin-cheat\genshin-cheat\genshincheat.sln]
D:\a\genshin-cheat\genshin-cheat\cheat-base\cheat-base.vcxproj(25,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
D:\a\genshin-cheat\genshin-cheat\cheat-library\cheat-library.vcxproj(757,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
D:\a\genshin-cheat\genshin-cheat\injector\injector.vcxproj(39,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
4 Warning(s)
3 Error(s)
Time Elapsed 00:00:12.01
Error: Process completed with exit code 1.
I suppose this is because of the non - existence of the file mentioned
my repo has a solution file and with it 3 subfolders. in the error "cheat-base\cheat-base.vcxproj(25,3)" was missing so i suppose one of the subfolders i.e. cheat-base isnt being cloned. any solutions?
adding recursive instead of true to subfolder solved this

Azure Devops: Error: No package found with specified pattern: D:\a\1\s\**\*.zip

I'm trying to set up my first pipeline to deploy a web app to an Azure App service. I am able to manually publish the site via Visual Studio but now I am trying to get it build and deploy from an Azure Repo. The build part works fine and without errors. The problem comes in when I add in the deploy task. The deploy task doesn't seem to be able to find the file/s to deploy.
My Pipeline
My Publish config:
In my Pipeline the Publish section shows the following debug info:
##[debug]Exit code 0 received from tool 'C:\Program Files\dotnet\dotnet.exe'
##[debug]STDIO streams have closed for tool 'C:\Program Files\dotnet\dotnet.exe'
##[debug]modifyOutputPath=true
##[debug]Zip Source: D:\a\1\a\s
##[debug]Zip arguments: Source: D:\a\1\a\s , target: D:\a\1\a\s.zip
##[debug]Successfully created archive D:\a\1\a\s.zip
##[debug]rm -rf D:\a\1\a\s
##[debug]removing directory D:\a\1\a\s
The Publish Artifact config section:
The Publish Artifact section shows the following success message:
File upload succeed.
Upload 'D:\a\1\a' to file container: '#/10370704/drop'
Associated artifact 541 with build 667
The Web Deployment config looks like this:
Then the Azure Web App Deployment shows the following debug and error message:
##[debug]pattern: 'D:\a\1\s**.zip'
##[debug]expanding braces
##[debug]pattern: 'D:/a/1/s/**/.zip'
##[debug]applying include pattern against original list
##[debug]0 matches
##[debug]0 final results
##[debug]No matching files were found with search pattern: D:\a\1\s**.zip
##[debug]Deployment Failed with Error: Error: No package found with specified pattern:
D:\a\1\s**.zipCheck if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.
##[debug]task result: Failed
##[error]Error: No package found with specified pattern: D:\a\1\s***.zip
You can try to use powershell task to list the files in the folder before publish the Azure Web App.
From your description, it seems the pattern should be $(Build.ArtifactStagingDirectory)/*.zip?

Configure Roslyn analyser in Azure Devops Yaml

I need help. I am trying to configure roslyn code analyser in azure devops. I need the MsCommandLine to add this roslyn analyser.
and the build task generated is
- task: RoslynAnalyzers#3 inputs:
userProvideBuildInfo: 'msBuildInfo'
msBuildVersion: '16.0'
msBuildArchitecture: 'amd64'
msBuildCommandline: '$(Parameters.solution)'
But i am getting error
MSBUILD : error MSB1003: Specify a project or solution file. The
current working directory does not contain a project or solution
file.
What should be added in MSBuildCommandLine to specify source directory of the project?
I have referred to https://secdevtools.azurewebsites.net/helpRoslynAnalyzers.html
and https://www.1eswiki.com/wiki/Secure_Development_Tools_Extension_For_Azure_DevOps .
I am not getting any clue about this MSCommandLine. How to specify it?
The commandline should begin with a full path to MSBuild.exe.
The command will run with $(Build.SourcesDirectory) as the working directory. You may specify the full path to MSBuild.exe, and try again.
The commandline should begin with a full path to MSBuild.exe or dotnet.exe. So your msBuildCommandline statement should look like below
msBuildCommandline: "C:\Program Files\dotnet\dotnet.exe" build '$(Parameters.solution)' ...

Building nuget file from nuspec with Azure Pipelines

I have ran into a strange problem and have been trying to fix for a couple of days. Locally, I can build my project just fine with the following nuspec file. The nuspec file is saved in the repo and copied local when built from the c# project and it is under a sub folder called "nugetcreation". Locally, I can run the nuspec file as is and it generates the nuget package.
Folder setup:
project
-project files
-nugetcreation
-readme and nuspec files
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>my.Utility.TraceWriter</id>
<version>1.0.0-beta</version>
<title>my.Utility.TraceWriter</title>
<authors>justme</authors>
<owners>justme</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>custom trace items</description>
<releaseNotes>initial release</releaseNotes>
</metadata>
<files>
<file src="Content\MyReadMes\My.Utility.TraceWriter.md" target="content\net461\MyReadMes\My.Utility.TraceWriter.md" />
<file src="..\My.Utility.TraceWriter.dll" target="lib\net461\My.Utility.TraceWriter.dll" />
<file src="..\My.Utility.TraceWriter.pdb" target="lib\net461\My.Utility.TraceWriter.pdb" />
</files>
</package>
The problem:
When I am building an Azure Pipeline, I tell it to run the nuspec file and I am getting an error
##[error]The nuget command failed with exit code(1) and error(Error NU5019: File not found: '..\My.Utility.TraceWriter.dll'.
But it is absolutely being generated correctly from the vsbuild process
CopyFilesToOutputDirectory:
Copying file from "d:\a\1\s\My.Utility.TraceWriter\My.Utility.MethodTracer\obj\Release\My.Utility.TraceWriter.dll" to "d:\a\1\s\My.Utility.TraceWriter\My.Utility.MethodTracer\bin\Release\My.Utility.TraceWriter.dll"
The nuget creation step in the azure pipeline is pretty basic, nothing fancy. All of the fancy stuff I am keeping in the nuspec file. I am trying to get this to work on a basic project with the nuspec file because I have much more complicated nuget packaging coming later so this is my test version.
- task: NuGetCommand#2
displayName: 'Creating nuget package'
inputs:
command: 'pack'
packagesToPack: '**/*.nuspec'
versioningScheme: 'off'
arguments: '--configuration $(buildConfiguration)'
So far I have tried using:
**\My.Utility.TraceWriter.dll (no error, but no dlls are in the lib folder. acts as if that line is just skipped)
bin**\My.Utility.TraceWriter.dll
.\My.Utility.TraceWriter.dll
$configuration$\My.Utility.TraceWriter.dll
**\$configuration$\My.Utility.TraceWriter.dll
...nothing works. Does anyone have any ideas about why the azure pipeline doesn't accept the correct (..\My.Utility.TraceWriter.dll) relative path entry on the nuspec file and how to fix it?
My forehead hurts from banging my keyboard against it...
--EDIT--
A little more info. It appears that 2 things are happening when the nuget pack command is ran. The entire output is below but it looks like after the nuget successfully builds it is trying to pack it again and this time can't find the files??
Added file '_rels/.rels'.
Added file 'My.Utility.TraceWriter.nuspec'.
Added file 'content/net461/MyReadMes/My.Utility.TraceWriter.md'.
Added file 'lib/net461/My.Utility.TraceWriter.dll'.
Added file 'lib/net461/My.Utility.TraceWriter.pdb'.
Added file 'package/services/metadata/core-properties/f2a4d059fea6458dac5889de57641f5b.psmdcp'.
Successfully created package 'D:\a\1\a\My.Utility.TraceWriter.1.0.0-beta.nupkg'.
WARNING: NU5128: Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below:
- Add a dependency group for .NETFramework4.6.1 to the nuspec
Attempting to pack file: D:\a\1\s\My.Utility.TraceWriter\My.Utility.MethodTracer\nuget information\My.Utility.TraceWriter.nuspec
C:\hostedtoolcache\windows\NuGet\5.4.0\x64\nuget.exe pack "D:\a\1\s\My.Utility.TraceWriter\My.Utility.MethodTracer\nuget information\My.Utility.TraceWriter.nuspec" -NonInteractive -OutputDirectory D:\a\1\a -Properties Configuration=Release -Verbosity Detailed
Error NU5019: File not found: '..\My.Utility.TraceWriter.dll'.
NuGet Version: 5.4.0.6315
NuGet.Packaging.Core.PackagingException: File not found: '..\My.Utility.TraceWriter.dll'.
Stupid. the packagesToPack: '**/*.nuspec' is pulling both nuspecs: the one in source AND the one copied to the output bin folder.
redefining fixed the issue

GoCD Nuget issue

I have a project and my agent does have nuget installed - Not sue what I am doign wwong
12:01:14.195 [go] Start to build DemoApp/20/second/1/secondJob on vivians-mbp-2.delta.rl.delta.com [/Users/vivianaranha/Library/Application Support/Go Agent]
12:01:14.195 [go] Current job status: passed.
12:01:14.195 [go] Start to execute task: <exec command="nuget restore packages.config -PackagesDirectory ..\..\packages" workingdir="EMApp\EMApp\EMApp.iOS" />.
12:01:14.199 Error happened while attempting to execute 'nuget restore packages.config -PackagesDirectory ..\..\packages'.
Please make sure [nuget restore packages.config -PackagesDirectory ..\..\packages] can be executed on this agent.
12:01:14.199 [Debug Information] Environment variable PATH: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/bin
12:01:14.206 [go] Current job status: failed.
Have you tried setting the build details to be more verbose? Also, from when i do it I have the build use the nuget.exe saved in the source control, not on the build agent
You are making a common mistake in GoCD expecting exec task to be a shell execution.
By that build log, I can tell that your configuration in xml is
<exec command="nuget restore packages.config -PackagesDirectory ..\..\packages" workingdir="EMApp\EMApp\EMApp.iOS">
</exec>
That means GoCD would be trying to execute a file whose path is nuget restore packages.config -PackagesDirectory ..\..\packages, which does not exist.
GoCD exec task requires you to explicitly separate process executable and all arguments. So the above nuget example would have to be configured like so:
<exec command="nuget" workingdir="EMApp\EMApp\EMApp.iOS">
<arg>restore</arg>
<arg>packages.config</arg>
<arg>-PackagesDirectory</arg>
<arg>..\..\packages</arg>
</exec>
More tips on task setup:
If nuget.exe is not in the PATH, you'll need to configure full file path e.g. command="C:\nuget\nuget.exe"
Here is a nice blog post on exec tasks
If you don't like setting up process and arguments separately like this, try script executor plugin which will start a shell.
Edit 1
On mac you would need to run nuget with mono. So the process executable is mono:
<exec command="mono" workingdir="EMApp\EMApp\EMApp.iOS">
<arg>/path/to/nuget</arg>
<arg>restore</arg>
<arg>packages.config</arg>
<arg>-PackagesDirectory</arg>
<arg>..\..\packages</arg>
</exec>