wix 3.x - Failed to load xml file - wix

I have a WIX package - created using Wix Toolset 3.7, which is strangely failing on a specific environment with the following message,
ExecXmlFile: Error 0x80070005: failed to load XML file:
\sharep001\share\IIS\pre\EAT\Website\CalculationService\Web.config
MSI (s) (70!FC) [11:15:37:491]: Product: EAT 1.0.0.0 -- Error 25531.
Failed to open XML file
\sharep001\share\IIS\pre\EAT\Website\CalculationService\Web.config,
system error: -2147024891
Error 25531. Failed to open XML file
\sharep001\share\IIS\pre\EAT\Website\CalculationService\Web.config,
system error: -2147024891
CustomAction ExecXmlFile returned actual error code 1603 (note this
may not be 100% accurate if translation happened inside sandbox)
Why I say the behavior is strange is because,
The same package I can install on the local directory on the webserver, no errors reported.
The same package I can install on another UNC directory, no errors reported.
Why is it failing?
- The XML transform step only gets called after the directory is created, files are dropped, iis website is created, etc. So, hard to explain why, does not seem like a permission issue.
Any idea how I can debug this?

It is strange that the path does not contain a root drive specification. Is it possible that this file is on a different drive than where the custom action is executing and thus the relative path is not being found? I would first try to provide a full path to the file and see if that addresses the issue.
To debug, you could go hardcore and grab the sources and pdbs .zip files for the WiX toolset build you are using then use MsiBreak environment variable to get attached to the custom action .dll. From there, you can debug through the ExecXmlFile() function to see the actual return result. You could also inspect the machine just before/after the error occurs to see if the file is locked or otherwise inaccessible.
Good luck!

Check if file has correct UTF-8 encoding, my fault was a missing BOM
Failed to open XML file , system error: -2147024786

Related

NETSDK1152 Error for _ViewImports.cshtml files

After upgrading my WebApp from NET5 to NET6, when trying to push my WebApp to the Azure AppService, I get the NETSDK1152 error:
Found multiple publish output files with the same relative path:
C:...\src\ProjA_ViewImports.cshtml,
C:...\src\ProjB_ViewImports.cshtml,
C:...\src\ProjC_ViewImports.cshtml
The projects in Question are Razor Class Libraries (Project Sdk="Microsoft.NET.Sdk.Razor"), which all get referenced by a regular Web App (). The files in question are _ViewImport.cshtml files to contain common usings/imports for my Views. They only have their standard properties which never got changed by me (Action -> Content, Copy to Output Directory -> Do not Copy).
Before updating to NET6, everything worked flawlessly, both on my local machine as well as on Azure (both publishing and running the application). After my upgrade to .NET6, I started receiving the error mentioned above.
However, this ONLY occurs when I use the publish functionality (or when the CI/CD is triggered by pushing to the remote git repo). If I use dotnet publish locally, everything seems to be published just fine.
Trying the usual recommendation, of turning off the error (as proposed, for instance, here), did not solve anything for me.
Apart from either getting rid of the _ViewImport.cshtml files altogether, or restructuring the project, I am lost with regards how to potentially solve this issue while keeping the structure as is.
The .NET SDK (6.0.100 Preview 1) generates a new error (NETSDK1152) in cases where files from different source paths would be copied to the same file path in the publish output. This can happen when a project and its project references include a file with the same name that's included in the publish output.
Old Behavior
Both files were copied to the same destination. The second file to be copied overwrote the first file, and which file "won" was mostly arbitrary.
In some cases, the build failed. For example, when trying to create a single-file app, the bundler failed with an ArgumentException, as shown in the following build output:
C:\Program Files\dotnet\sdk\5.0.100-preview.5.20258.6\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(962,5): error MSB4018: The "GenerateBundle" task failed unexpectedly. [C:\repro\repro.csproj]
C:\Program Files\dotnet\sdk\5.0.100-preview.5.20258.6\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(962,5): error MSB4018: System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath [C:\repro\repro.csproj]
C:\Program Files\dotnet\sdk\5.0.100-preview.5.20258.6\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(962,5): error MSB4018: at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) [C:\repro\repro.csproj]
New behavior
Starting in .NET 6, MSBuild removes duplicate files that are copied to the publish folder if both the source and destination are the same. If there are any remaining duplicates, a NETSDK1152 error is generated and lists the files that are duplicated.
Reason for change
Duplicate files in the publish output sometimes caused build breaks or unpredictable behavior.
Recommended action
Ideally, you should update your project to avoid situations where multiple files with the same name are copied to the publish output. The error message includes the name of the duplicate file. Some causes for duplicate files include:
An ASP.NET Core project that references an ASP.NET Core web service, and each has its own appsettings.json file.
A project item where CopyToOutputDirectory is unnecessarily set to Always.
Binary log files can be useful for finding the cause of the duplicated files.
Alternatively, you can set the ErrorOnDuplicatePublishOutputFiles property to false.

The process executed with the extension does not find the path to the referenced dll

The process executed with the extension does not find the path to the referenced dll.
It was normally used when it was executed with ".exe".
However, after running with the extension registered in the registry, trying to use the dll results in an error that the dll file cannot be found.
If you look at the content of the exception that occurred, the dll in the path of "C:\myfolder\myDll.dll" try to find to "c:\Windows\system32\myDll.dll".
How do I do anything other than put it in the System folder to ensure that the extension-enabled process recognizes the path in the dll ?
It is not possible to put it in the system folder, so another method is needed.
p.s ) When i open a process by right-clicking an icon in the taskbar while the process is floating, the newly opened process also generates the same invalid dll path error.
I fixed it.
it cause that "System.Environment.CurrentDirectory" and "AppDomain.CurrentDomain.BaseDirectory" were different.
so when Application start, Check each directory and change it if it is different.
my case in WPF, System.Environment.CurrentDirectory was Windows System folder.

How to edit a .NET config file with WiX AFTER its installation

I need to change an entry of a .NET config file.
The problem is that the App.config in the project folder needs to stay untouched, because otherwise the application won't work within the IDE anymore.
I need the installed .NET config file changed after its installation.
Whenever I try to reference that file and build my installer, i get an error that the file can't be found. Of course it can't be found there, because the installation folder doesn't exist, when I build the installer.
How can I achieve that goal?
You are not saying how you are editing it, but WIX has two facilities for doing this properly. You can use XmlFile or XmlConfig. These are scheduled at the proper time by WIX for you. You can set the path to the file a few ways as they accept a formatted string, so you can use an expected installed path or the file id.

SpecFlow error on build server

I am getting a strange error on the build server, this does NOT happen locally.
Error during file generation. The target file 'C:...\AcceptanceTest\Features\HelloWorld.feature.cs'
is read-only, but different from the transformation result. This
problem can be a sign of an inconsistent source code package. Compile
and check-in the current version of the file from the development
environment or remove the read-only flag from the generation result.
To compile a solution that contains messaging project on a build
server, you can also exclude the messaging project from the
build-server solution or set the msbuild
project parameter to 'true' in the messaging project file.
I'm not sure what to do to fix this, I don't have a "messaging" project (or know what is being referred too). And the code is the latest
This is the full message (some folder names have been obfuscated):
13>C:\Builds\2\Services\PService\src\packages\SpecRun.Excel.1.1.0\tools\TechTalk.SpecFlow-buildfix.targets(47,5):
error : Error during file generation. The target file
'C:\Builds\2\Services\PService\src\PService\Test\PService.AcceptanceTest\Features\HelloWorld.feature.cs'
is read-only, but different from the transformation result. This
problem can be a sign of an inconsistent source code package. Compile
and check-in the current version of the file from the development
environment or remove the read-only flag from the generation result.
To compile a solution that contains messaging project on a build
server, you can also exclude the messaging project from the
build-server solution or set the msbuild
project parameter to 'true' in the messaging project file.
[C:\Builds\2\Services\PService\src\PService\Test\PService.AcceptanceTest\PService.AcceptanceTest.csproj]
13>C:\Builds\2\Services\PService\src\packages\SpecRun.Excel.1.1.0\tools\TechTalk.SpecFlow-buildfix.targets(47,5):
error : Could not find file
'C:\Users\tfsbuild\AppData\Local\Temp\tmpPWithData.feature.xlsx.cs'.
[C:\Builds\2\Services\PService\src\PService\Test\PService.AcceptanceTest\PService.AcceptanceTest.csproj]
13>C:\Builds\2\Services\PService\src\PService\Test\PService.AcceptanceTest\Features\PWithData.feature.xlsx
: error : Generation error: Could not find file
'C:\Users\tfsbuild\AppData\Local\Temp\tmpPWithData.feature.xlsx.cs'.
[C:\Builds\2\Services\PService\src\PService\Test\PService.AcceptanceTest\PService.AcceptanceTest.csproj]
Delete HelloWorld.feature.cs from source control.
TFS will checkout files as read-only during a build and so SpecFlow fails to re-generate the file because it already exists and SpecFlow doesn't overwrite read-only files.
I created a new request for SpecFlow to not automatically add the file to source control here: https://github.com/techtalk/SpecFlow/issues/592
I'm not sure what the messaging project refers to, that's something I haven't seen before.
However the error reads as if the problem is due to an issue with the generation of the *.feature.cs from the *.feature file, but I am confused as to why this should be happening on the build server. Normally the generation of *.feature.cs occurs in the IDE when you save the *.feature file. This gets checked in and with some version control systems (VCS) you may end up with a read-only file status.
Your error reads as the build server is trying to re-generate the *.feature.cs file and cannot overwrite it.
Some things to check;
What VCS are you running? Does it leave checked-in files as read-only?
How are you building the files on the build server? Is there a custom step involved, or is it just a simple compile?
Can you replicate this error on your machine by setting the *.feature.cs to read-only and running the same build script on your local machine?
Good luck.

mono Newbie. Installed but env vars not set.. maybe things missing

I'm just installing mono to learn how it all works.
I installed mono (mono-2.10.9-gtksharp-2.12.11-win32-0.exe) for the first time and just started to follow on through the Mono Basics page to verify the installation.
http://www.mono-project.com/Mono_Basics
I was surprised that the installer didn't set up the PATH env variable , but once I'd done that I was able to get the first example compiling/running.
But I'm getting compile errors on the second example. So am wondering if I am missing further environment variables/settings?
Are the environment variables used by mono documented anywhere?
I'm also just wondering if the installer is ok or should I be looking for another one...
The error messages are as follows:
C:\Users\Vida\Desktop\Learning\Mono>gmcs hello.cs -pkg:gtk-sharp-2.0
error CS2001: Source file `Files' could not be found
error CS2001: Source file
`(x86)/Mono-2.10.9/lib/mono/gtk-sharp-2.0/pango-sharp.dll' could not
be found
error CS2001: Source file
`(x86)/Mono-2.10.9/lib/mono/gtk-sharp-2.0/atk-sharp.dll' could not
be found
error CS2001: Source file
`(x86)/Mono-2.10.9/lib/mono/gtk-sharp-2.0/gdk-sharp.dll' could not
be found
error CS2001: Source file
`(x86)/Mono-2.10.9/lib/mono/gtk-sharp-2.0/gtk-sharp.dll' could not
be found
error CS2001: Source file
`(x86)/Mono-2.10.9/lib/mono/gtk-sharp-2.0/glib-sharp.dll' could not
be found
Compilation failed: 6 error(s), 0 warnings
Sounds like some component is confused by the spaces in Program Files (x86) (which is presumably the installation directory.) Try setting the PATH using its short name (normally Progra~2) , or reinstall to a directory that doesn't have spaces. You can also try additionally setting the MONO_PATH environment variable.