WiX dotnet publish Cant find csproject file

545 Views Asked by At

I'm new to WiX and I'm trying to follow this tutorial on publishing a .msi file (I'm at 1h and 20m into the video)and every time I try to run the dotnet publish from my visual studio project file which has an Exec Command line in it, I get this error:

Severity    Code    Description Project File    Line    Suppression State
Error       The system cannot find the file specified. (Exception from HRESULT: 0x80070002) HelloWorld.Installer    light.exe   0   

Here is the complete output

dotnet publish ..\HelloWorld\HelloWorld.csproj -c Debug -r win-x86
1>      Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
1>      Copyright (C) Microsoft Corporation. All rights reserved.
1>        Determining projects to restore...
1>        Nothing to do. None of the projects specified contain packages to restore.
1>      \\Mac\Home\Desktop\M\HelloWorld\packages\WiX.3.11.2\build\..\tools\candle.exe -dDebug -d"DevEnvDir=C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\\" -dSolutionDir=\\Mac\Home\Desktop\MainDirectory\HelloWorld\ -dSolutionExt=.sln -dSolutionFileName=HelloWorld.sln -dSolutionName=HelloWorld -dSolutionPath=\\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld.sln -dConfiguration=Debug -dOutDir=bin\Debug\ -dPlatform=x86 -dProjectDir=\\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld.Installer\ -dProjectExt=.wixproj -dProjectFileName=HelloWorld.Installer.wixproj -dProjectName=HelloWorld.Installer -dProjectPath=\\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld.Installer\HelloWorld.Installer.wixproj -dTargetDir=\\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld.Installer\bin\Debug\ -dTargetExt=.msi -dTargetFileName=HelloWorld.Installer.msi -dTargetName=HelloWorld.Installer -dTargetPath=\\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld.Installer\bin\Debug\HelloWorld.Installer.msi -dHelloWorld.Configuration=Debug -d"HelloWorld.FullConfiguration=Debug|AnyCPU" -dHelloWorld.Platform=AnyCPU -dHelloWorld.ProjectDir=\\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld\ -dHelloWorld.ProjectExt=.csproj -dHelloWorld.ProjectFileName=HelloWorld.csproj -dHelloWorld.ProjectName=HelloWorld -dHelloWorld.ProjectPath=\\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld\HelloWorld.csproj -dHelloWorld.TargetDir=\\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld\bin\Debug\ -dHelloWorld.TargetExt=.dll -dHelloWorld.TargetFileName=HelloWorld.dll -dHelloWorld.TargetName=HelloWorld -dHelloWorld.TargetPath=\\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld\bin\Debug\HelloWorld.dll -out obj\Debug\ -arch x86 -ext \\Mac\Home\Desktop\MainDirectory\HelloWorld\packages\WiX.3.11.2\build\..\tools\\WixUIExtension.dll Components.wxs Directories.wxs Product.wxs
1>      \\Mac\Home\Desktop\MainDirectory\HelloWorld\packages\WiX.3.11.2\build\..\tools\Light.exe -out \\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld.Installer\bin\Debug\en-us\HelloWorld.Installer.msi -pdbout \\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld.Installer\bin\Debug\en-us\HelloWorld.Installer.wixpdb -cultures:en-us -ext \\Mac\Home\Desktop\MainDirectory\HelloWorld\packages\WiX.3.11.2\build\..\tools\\WixUIExtension.dll -loc Common.wxl -contentsfile obj\Debug\HelloWorld.Installer.wixproj.BindContentsFileListen-us.txt -outputsfile obj\Debug\HelloWorld.Installer.wixproj.BindOutputsFileListen-us.txt -builtoutputsfile obj\Debug\HelloWorld.Installer.wixproj.BindBuiltOutputsFileListen-us.txt -wixprojectfile \\Mac\Home\Desktop\MainDirectory\HelloWorld\HelloWorld.Installer\HelloWorld.Installer.wixproj obj\Debug\Components.wixobj obj\Debug\Directories.wixobj obj\Debug\Product.wixobj
1>light.exe(0,0): error LGHT0001: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)

Here is the line I'm running in my project file in the Before Build:

    <Exec Command="dotnet publish ..\HelloWorld\HelloWorld.csproj -c $(Configuration) -r win-$(Platform)" />

I am not sure but I believe the error means that it cant find the .csproj file to publish.

My project tree is:

├── HelloWorld
│   ├── App.cs
│   ├── Command.cs
│   ├── HelloWorld.addin
│   ├── HelloWorld.csproj
│   ├── Properties
│   │   └── AssemblyInfo.cs
│   ├── SyncManager32.png
│   ├── bin
│   │   └── Debug
│   │       ├── HelloWorld.dll
│   │       └── HelloWorld.pdb
│   └── obj
│       └── Debug
│           ├── DesignTimeResolveAssemblyReferences.cache
│           ├── DesignTimeResolveAssemblyReferencesInput.cache
│           ├── HelloWorld.csproj.AssemblyReference.cache
│           ├── HelloWorld.csproj.CoreCompileInputs.cache
│           ├── HelloWorld.csproj.FileListAbsolute.txt
│           ├── HelloWorld.dll
│           ├── HelloWorld.pdb
│           └── TempPE
├── HelloWorld.Installer

As you can see from the tree, it should work with the Exec Command="dotnet publish ..\HelloWorld\HelloWorld.csproj -c Debug -r win-x86 " because it just has to go up one folder level, then into HelloWorld and find the .csproj file but for some reason, it's not finding it.

I'm running on my Macbook pro with executing this command on Visual Studio in my Parallels remote desktop.

I've been at this for a couple of days and can't figure it out. Any help/and or direction is appreciated! let me know if I can add any additional information that could be helpful.

1

There are 1 best solutions below

0
On

I figured it out. It looks like when I opened the project, I opened it from "This PC", therefore visual studio / the dotnet publish command was reading it from my \mac\Home\etc drive and thus wasn't able to find the same drive. ie, on Command-Line, you can cd to \mac\home\etc. Parallels had my entire mac on a Y drive.

I closed visual studio and then opened up the project from the Y drive and ran the command and it worked.