Visual Studio $(ProjectDir) is empty string - c#

I am using Visual Studio 2017 and I want to add a post-build command. when I go to 'Macros' window I see the correct path coresponging to $(ProjectDir) variable. So I added the command:
$(ProjectDir)ClientApp\npm run build
but when I execute build I get the following error:
The command 'ClientApp\npm run build'exited with code 3.
I change MSBuild verbose to Diagnose and in the Output window I saw:
1>Target "PostBuildEvent" in file "C:\Program Files (x86)\Microsoft
Visual
Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets":
1> Using "Exec" task from assembly "Microsoft.Build.Tasks.Core,
Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1> Task "Exec" 1> Task
Parameter:WorkingDirectory=bin\Debug\netcoreapp1.1\ 1> Task
Parameter:Command=ClientApp\npm run build 1> ClientApp\npm run
build 1> The system cannot find the path specified. 1>
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4933,5):
error MSB3073: The command "ClientApp\npm run build" exited with code
3. 1> Done executing task "Exec" -- FAILED.
In the targets file I got these lines:
<Target
Name="PostBuildEvent"
Condition="'$(PostBuildEvent)' != '' and ('$(RunPostBuildEvent)' != 'OnOutputUpdated' or '$(_AssemblyTimestampBeforeCompile)' != '$(_AssemblyTimestampAfterCompile)')"
DependsOnTargets="$(PostBuildEventDependsOn)">
<Exec WorkingDirectory="$(OutDir)" Command="$(PostBuildEvent)" />
</Target>
Can I change the working dir from $(OutDir) to $(ProjectDir) and how?
Any ideas where I am mistaken?
NB - I added the command in a BAT file, just to test but the result was the same

Try $(MSBuildProjectDirectory) instead

The problem could affect other VS variable as well.
The universal solution is described here.

Related

How to setup ASP.NET Web Application with Docker container

I have followed the installation instructions found here: https://azure.microsoft.com/en-us/documentation/articles/vs-azure-tools-docker-edit-and-refresh/
and made an empty ASP.Net hello world project. I keep getting this error when I try to build my project:
Error MSB3073 The command "powershell -ExecutionPolicy RemoteSigned .\Docker\DockerTask.ps1 -Build -Environment Debug -Machine 'default'" exited with code 1. HelloWorld C:\dev\HelloWorld\src\HelloWorld\Properties\Docker.targets 37
Upon further digging I get this error:
1>------ Build started: Project: HelloWorld, Configuration: Debug Any CPU ------
1>
1> Build succeeded.
1> 0 Warning(s).
1> 0 Error(s).
1>
1> Time elapsed 00:00:00.0958314
1>
1> .\Docker\DockerTask.ps1 : The term '.\Docker\DockerTask.ps1' is not recognized as the name of a cmdlet, function,
1> script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
1> correct and try again.
1> At line:1 char:1
1> + .\Docker\DockerTask.ps1 -Build -Environment Debug -Machine 'default'
1> + ~~~~~~~~~~~~~~~~~~~~~~~
1> + CategoryInfo : ObjectNotFound: (.\Docker\DockerTask.ps1:String) [], CommandNotFoundException
1> + FullyQualifiedErrorId : CommandNotFoundException
1>
1>C:\dev\HelloWorld\src\HelloWorld\Properties\Docker.targets(37,5): error MSB3073: The command "powershell -ExecutionPolicy RemoteSigned .\Docker\DockerTask.ps1 -Build -Environment Debug -Machine 'default'" exited with code 1.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
I am using Visual Studios 2015 on Windows 10 64bit.
The problem was my working directory was set differently than the default settings. By using the get-location command I was able to figure out where the working directory was and give it the relative path from that directory.
HelloWorld\src\HelloWorld\Docker\DockerTask.ps1
Rightly pointed out by SirJackovich.
The issue was due to a mis-pointed folder path given to msbuild.
To check out what path to modify, follow these steps:
In Properties\Docker.targets,
a. Temporarily change DockerBuildCommand to <DockerBuildCommand>powershell get-location</DockerBuildCommand>.
b. Temporarily change DockerCleanCommand to <DockerCleanCommand>powershell get-location</DockerCleanCommand>.
c. Run build having Docker build target selected (instead of 'IIS Express').
d. From the trace output in the Output window, it will print the folder which is the root for execution. For example, c:\folder1 is the root execution folder for powershell.
e. Lets say DockerTask.ps1 is located in c:\folder1\MyApp\src\App1\DockerTask.ps1. Modify the DockerBuildCommand command within Properties\Docker.targets to point to MyApp\src\App1\DockerTask.ps1. Also Modify the DockerCleanCommand command to point to MyApp\src\App1\DockerTask.ps1.
powershell -ExecutionPolicy RemoteSigned MyApp\src\App1\DockerTask.ps1.ps1 -Build -Environment $(Configuration) -Machine '$(DockerMachineName)' -ClrDebugVersion VS2015U2
powershell -ExecutionPolicy RemoteSigned MyApp\src\App1\DockerTask.ps1 -Clean -Environment $(Configuration) -Machine '$(DockerMachineName)'
f. Rebuild the solution.
This will deploy the image to the default docker environment within docker-machine.

VSCT.exe Could not load file or assembly

I am trying to build a Visual Studio Package from the command line and running into problems.
The project builds perfectly inside the Visual Studio environment, both release and debug. I am just trying to get the project to build through command line as well. Other projects, not Visual Studio Package projects, build fine. The problem is the introduction of the VSSDK.
Error:
12:33:41.147 2>C:\Program Files (x86)\MSBuild\Microsoft VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets(107,5): error VSSDK1000: Failed to load 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VSSDK\VisualStudioIntegration\Tools\bin\VSCT.exe' Assembly. Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Visual Studio 12.0\VSSDK\VisualStudioIntegration\Tools\bin\VSCT.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format. [C:\VsProjects\MyProject\MyProject.csproj]
Done executing task "VSCTCompiler" -- FAILED. (TaskId:24)
12:33:41.147 2>Done building target "VSCTCompile" in project "MyProject.csproj" -- FAILED.: (TargetId:42)
12:33:41.147 2>Target "_CheckForCompileOutputs: (TargetId:43)" in file "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets" from project "C:\VsProjects\MyProject\MyProject.csproj" (target "_CleanGetCurrentAndPriorFileWrites" depends on it):
I did see these articles, the first of which helped the most and got me past the previous error and onto this error:
MS Build with VS2012 Package Project
MS Build command line...VSSDK
Build a VS Package in Team Environment
I set the VSSDKInstall path to:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VSSDK
My system: Windows 8.1 Pro X64
Build: Any CPU
I do realize that the project builds in 32-bit environment from what I have read.
I did implement:
Set VSSDKInstall environment variable and restart
Execute: call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\vsvars32.bat"
Do the ms build call
I ran the diagnostic build and here is a larger fragment:
12:33:41.132 2>Done building target "PrepareRdlFiles" in project "MyProject.csproj".: (TargetId:39)
Target "RunRdlCompiler" skipped, due to false condition; ('#(RdlFile)'!='') was evaluated as (''!='').
12:33:41.133 2>Target "CompileRdlFiles: (TargetId:40)" in file "C:\Program Files (x86)\MSBuild\Microsoft VisualStudio\v12.0\ReportingServices\Microsoft.ReportingServices.targets" from project "C:\VsProjects\MyProject\MyProject.csproj" (target "PrepareResources" depends on it):
12:33:41.133 2>Done building target "CompileRdlFiles" in project "MyProject.csproj".: (TargetId:40)
12:33:41.133 2>Target "GenerateListOfCTO: (TargetId:41)" in file "C:\Program Files (x86)\MSBuild\Microsoft VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets" from project "C:\VsProjects\MyProject\MyProject.csproj" (target "MergeCtoResource" depends on it):
Task "AssignCulture" (TaskId:23)
Task Parameter:
Files=
obj\Debug\MyProject.cto
ResourceName=Menus.ctmenu (TaskId:23)
Culture of "" was assigned to file "obj\Debug\MyProject.cto". (TaskId:23)
Done executing task "AssignCulture". (TaskId:23)
12:33:41.133 2>Done building target "GenerateListOfCTO" in project "MyProject.csproj".: (TargetId:41)
Target "FindSDKInstallation" skipped, due to false condition; ('$(VsSDKInstall)'=='') was evaluated as ('C:\Program Files (x86)\Microsoft Visual Studio 12.0\VSSDK'=='').
12:33:41.133 2>Target "VSCTCompile: (TargetId:42)" in file "C:\Program Files (x86)\MSBuild\Microsoft VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets" from project "C:\VsProjects\MyProject\MyProject.csproj" (target "MergeCtoResource" depends on it):
Using "VSCTCompiler" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Build.Tasks.dll".
Task "VSCTCompiler" (TaskId:24)
Task Parameter:IntermediateDirectory=obj\Debug\ (TaskId:24)
Task Parameter:
Definitions=
__CTC__
_CTC_GUIDS_ (TaskId:24)
Task Parameter:NoLogo=True (TaskId:24)
Task Parameter:OutputFile=MyProject.cto (TaskId:24)
Task Parameter:Source=MyProject.vsct (TaskId:24)
Task Parameter:Verbose=False (TaskId:24)
Task Parameter:SDKVersion=12.0 (TaskId:24)
12:33:41.147 2>C:\Program Files (x86)\MSBuild\Microsoft VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets(107,5): error VSSDK1000: Failed to load 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VSSDK\VisualStudioIntegration\Tools\bin\VSCT.exe' Assembly. Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Visual Studio 12.0\VSSDK\VisualStudioIntegration\Tools\bin\VSCT.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format. [C:\VsProjects\MyProject\MyProject.csproj]
Done executing task "VSCTCompiler" -- FAILED. (TaskId:24)
12:33:41.147 2>Done building target "VSCTCompile" in project "MyProject.csproj" -- FAILED.: (TargetId:42)
12:33:41.147 2>Target "_CheckForCompileOutputs: (TargetId:43)" in file "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets" from project "C:\VsProjects\MyProject\MyProject.csproj" (target "_CleanGetCurrentAndPriorFileWrites" depends on it):
12:33:41.148 2>Done building target "_CheckForCompileOutputs" in project "MyProject.csproj".: (TargetId:43)
Target "_SGenCheckForOutputs" skipped, due to false condition; ('$(_SGenGenerateSerializationAssembliesConfig)' == 'On' or ('#(WebReferenceUrl)'!='' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto')) was evaluated as ('Off' == 'On' or (''!='' and 'Off' == 'Auto')).
12:33:41.148 2>Target "_CleanGetCurrentAndPriorFileWrites: (TargetId:44)" in file "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets" from project "C:\VsProjects\MyProject\MyProject.csproj" (target "_CleanRecordFileWrites" depends on it):
Here is the normal output:
1/4/2015 1:10:05 PM: Building project step 11 - Build: Debug (Any CPU)...
Pre-processing...
Building configuration 'Debug|Any CPU'...
Microsoft (R) Build Engine version 12.0.31101.0
[Microsoft .NET Framework, version 4.0.30319.34014]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 1/4/2015 1:10:06 PM.
1>Project "C:\VsProjects\MyProject.sln" on node 1 (default targets).
1>ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
1>Project "C:\VsProjects\MyProject.sln" (1) is building "C:\VsProjects\MyProject\MyProject.csproj" (2) on node 1 (default targets).
2>MainResourcesGeneration:
Skipping target "MainResourcesGeneration" because all output files are up-to-date with respect to the input files.
CoreResGen:
No resources are out of date with respect to their source files. Skipping resource generation.
2>C:\Program Files (x86)\MSBuild\Microsoft VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets(107,5): error VSSDK1000: Failed to load 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VSSDK\VisualStudioIntegration\Tools\bin\VSCT.exe' Assembly. Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Visual Studio 12.0\VSSDK\VisualStudioIntegration\Tools\bin\VSCT.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format. [C:\VsProjects\MyProject\MyProject.csproj]
2>Done Building Project "C:\VsProjects\MyProject\MyProject.csproj" (default targets) -- FAILED.
1>Done Building Project "C:\VsProjects\MyProject.sln" (default targets) -- FAILED.
Build FAILED.
"C:\VsProjects\MyProject.sln" (default target) (1) ->
"C:\VsProjects\MyProject\MyProject.csproj" (default target) (2) ->
(VSCTCompile target) ->
C:\Program Files (x86)\MSBuild\Microsoft VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets(107,5): error VSSDK1000: Failed to load 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VSSDK\VisualStudioIntegration\Tools\bin\VSCT.exe' Assembly. Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Visual Studio 12.0\VSSDK\VisualStudioIntegration\Tools\bin\VSCT.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format. [C:\VsProjects\MyProject\MyProject.csproj]
UPDATE:
The problem might be what I set the VSSDKInstall environment variable to, because I tried to build the project inside VS and failed, both in debug and release. I was forced to remove the environment variable and restart the computer.
UPDATE: January 29, 2015
Full path is:
C:\Program Files (x86)\MSBuild\12.0\bin\amd64\msbuild.exe
I use a build utility, which calls a script.
Here is an excerpt from the diagnostic msbuild. I cut out extraneous things.
Building configuration 'Debug|Any CPU'...
Microsoft (R) Build Engine version 12.0.31101.0
[Microsoft .NET Framework, version 4.0.30319.18444]
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\MSBuild\12.0\bin\amd64\msbuild.exe /maxcpucount:1 /p:Platform=Any CPU /v:diagnostic <path to project>\myproject.sln
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 1/29/2015 8:04:26 AM.
Environment at start of build:
ALLUSERSPROFILE = C:\ProgramData
ANT_HOME = C:\SoftDev\Tools\Java\Ant\apache-ant-1.9.3
APPDATA = C:\Users\sarahmarci.JMR\AppData\Roaming
ArmServerInfo = 02272370
asl.log = Destination=file
Done building target "ResGen" in project "myproject.csproj".: (TargetId:37)
Target "CompileLicxFiles" skipped, due to false condition; ('#(_LicxFile)'!='') was evaluated as (''!='').
Target "PrepareRdlFiles: (TargetId:38)" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\ReportingServices\Microsoft.ReportingServices.targets" from project "<path to project>\<my project>\myproject.csproj" (target "CompileRdlFiles" depends on it):
Task "CreateItem" skipped, due to false condition; ('%(Extension)'=='.rdlc') was evaluated as ('.resx'=='.rdlc').
Task "CreateItem" skipped, due to false condition; ('%(Extension)'=='.rdlc') was evaluated as ('.ico'=='.rdlc').
Task "CreateItem" skipped, due to false condition; ('%(Extension)'=='.rdlc') was evaluated as ('.png'=='.rdlc').
Task "CreateItem" skipped, due to false condition; ('%(Extension)'=='.rdlc') was evaluated as ('.rtf'=='.rdlc').
Task "CreateItem" skipped, due to false condition; ('%(Extension)'=='.rdlc') was evaluated as ('.docx'=='.rdlc').
Task "CreateItem" skipped, due to false condition; ('%(Extension)'=='.rdlc') was evaluated as ('.txt'=='.rdlc').
Done building target "PrepareRdlFiles" in project "myproject.csproj".: (TargetId:38)
Target "RunRdlCompiler" skipped, due to false condition; ('#(RdlFile)'!='') was evaluated as (''!='').
Target "CompileRdlFiles: (TargetId:39)" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\ReportingServices\Microsoft.ReportingServices.targets" from project "<path to project>\<my project>\myproject.csproj" (target "PrepareResources" depends on it):
Done building target "CompileRdlFiles" in project "myproject.csproj".: (TargetId:39)
Target "GenerateListOfCTO: (TargetId:40)" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets" from project "<path to project>\<my project>\myproject.csproj" (target "MergeCtoResource" depends on it):
Task "AssignCulture" (TaskId:22)
Task Parameter:
Files=
obj\Debug\myproject.cto
ResourceName=Menus.ctmenu (TaskId:22)
Culture of "" was assigned to file "obj\Debug\myproject.cto". (TaskId:22)
Done executing task "AssignCulture". (TaskId:22)
Done building target "GenerateListOfCTO" in project "myproject.csproj".: (TargetId:40)
Target "FindSDKInstallation: (TargetId:41)" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets" from project "<path to project>\<my project>\myproject.csproj" (target "VSCTCompile" depends on it):
Using "FindVsSDKInstallation" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Build.Tasks.dll".
Task "FindVsSDKInstallation" (TaskId:23)
Task Parameter:SDKVersion=12.0 (TaskId:23)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets(74,5): error VSSDK1036: Can not find the installation for VS SDK. [<path to project>\<my project>\myproject.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets(76,7): error MSB4018: The "FindVsSDKInstallation" task failed unexpectedly. [<path to project>\<my project>\myproject.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets(76,7): error MSB4018: System.ArgumentNullException: Value cannot be null. [<path to project>\<my project>\myproject.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets(76,7): error MSB4018: Parameter name: path1 [<path to project>\<my project>\myproject.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets(76,7): error MSB4018: at System.IO.Path.Combine(String path1, String path2) [<path to project>\<my project>\myproject.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets(76,7): error MSB4028: The "FindVsSDKInstallation" task's outputs could not be retrieved from the "IncludesPath" parameter. Value cannot be null. [<path to project>\<my project>\myproject.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.Common.targets(76,7): error MSB4028: Parameter name: path1 [<path to project>\<my project>\myproject.csproj]
Done executing task "FindVsSDKInstallation" -- FAILED. (TaskId:23)
Thoughts?
I had faced similar problem and here's how I solved it.
Few facts before that:
1) VSCT.exe is a 32-bit exe. That's the only version which is shipped. You can confirm that by locating the exe listed in the error message and running "dumpbin /headers vsct.exe" and see that it's a x86 (or 32-bit) binary.
2) A 64-bit exe/dll cannot load a 32-bit binary. And if tried gives this "incorrect format" exception which you are seeing in your exception details.
3) MSBuild.exe ships as both 64-bit and 32-bit binaries.
Answer:
This error will happen if you use 64-bit MSBuild.exe to compile any project containing VSCTCompile target. The reason is VSCT.exe is a 32-bit exe and you are trying to call that from 64-bit msbuild.exe.
Fix:
To fix this, you should either explicitly use 32-bit msbuild.exe or open a 32-bit command line. Here's how you do that: http://www.tipandtrick.net/how-to-open-and-run-32-bit-command-prompt-in-64-bit-x64-windows/
If you run msbuild from 32-bit command line window then your build should succeed.

Packed Excel Addin not working created using Excel DNA c#

I have an AddIn created using Excel DNA c#.
Everything works fine.
I've packed the required dll's in .dna file my dna file is as follows
<DnaLibrary RuntimeVersion="v4.0" Language="C#">
<ExternalLibrary Path="ExcelAddInClient.dll" Pack="true"/>
<ExternalLibrary Path="Newtonsoft.Json.dll" Pack="true"/>
<ExternalLibrary Path="System.Net.Http.Formatting.dll" Pack="true"/>
<ExternalLibrary Path="AuthenticationDll.dll" Pack="true"/>
</DnaLibrary>
when i double click the packed filed from Release folder it works fine.but if i copy that xll file to some other location its not working.It doesn't show any Error but It doesn't shows the Desired Output as well.
I am not geting why???
Only the Excel add-in assembly should be referenced using the ExternalLibrary tag in the .dna file.
All other assemblies should be using Reference.
E.g.
<DnaLibrary RuntimeVersion="v4.0" Language="C#">
<ExternalLibrary Path="ExcelAddInClient.dll" Pack="true"/>
<Reference Path="Newtonsoft.Json.dll" Pack="true"/>
<Reference Path="System.Net.Http.Formatting.dll" Pack="true"/>
<Reference Path="AuthenticationDll.dll" Pack="true"/>
</DnaLibrary>
You are probably missing some dlls, or other necessary files. Look in the release folder, and see what else is there.
You could try copying all of the other files along with the packed xll, and then deleting these other files one at a time to see which ones are necessary. Then add these extra necessary files into the dna file.
Also, did you know that you can debug into Excel? Use "Debug"/"Attach to Process", from Visual Studio, and connect to Excel. Then open the xll from Excel. This will hopefully show you the error.
In my case, I worked out the issue by looking at the output of the compile step.
View..Output should have no obvious errors. This is what it should look like:
1>------ Build started: Project: ExcelDNA2, Configuration: Release Any CPU ------
1> ExcelDNA2 -> H:\Test\Docs\SpecsProofOfConcept\ExcelDNA2\bin\Release\ExcelDNA2.dll
1> H:\Test\Docs\SpecsProofOfConcept\\packages\ExcelDna.AddIn.0.33.9\tools\ExcelDna.xll
1> 1 File(s) copied
1> H:\Test\Docs\SpecsProofOfConcept\ExcelDNA2\bin\Release\ExcelDNA2-AddIn.dna
1> 1 File(s) copied
1> H:\Test\Docs\SpecsProofOfConcept\\packages\ExcelDna.AddIn.0.33.9\tools\ExcelDna64.xll
1> 1 File(s) copied
1> Using base add-in H:\Test\Docs\SpecsProofOfConcept\ExcelDNA2\bin\Release\ExcelDNA2-AddIn.xll
1> -> Updating resource: Type: ASSEMBLY_LZMA, Name: EXCELDNA.INTEGRATION, Length: 63672
1> ~~> ExternalLibrary path ExcelDNA2.dll resolved to H:\Test\Docs\SpecsProofOfConcept\ExcelDNA2\bin\Release\ExcelDNA2.dll.
1> -> Updating resource: Type: ASSEMBLY_LZMA, Name: EXCELDNA2, Length: 1605
1> -> Updating resource: Type: DNA, Name: __MAIN__, Length: 417
1> Completed Packing H:\Test\Docs\SpecsProofOfConcept\ExcelDNA2\bin\Release\ExcelDNA2-AddIn-packed.xll.
1> Using base add-in H:\Test\Docs\SpecsProofOfConcept\ExcelDNA2\bin\Release\ExcelDNA2-AddIn64.xll
1> -> Updating resource: Type: ASSEMBLY_LZMA, Name: EXCELDNA.INTEGRATION, Length: 63672
1> ~~> ExternalLibrary path ExcelDNA2.dll resolved to H:\Test\Docs\SpecsProofOfConcept\ExcelDNA2\bin\Release\ExcelDNA2.dll.
1> -> Updating resource: Type: ASSEMBLY_LZMA, Name: EXCELDNA2, Length: 1605
1> -> Updating resource: Type: DNA, Name: __MAIN__, Length: 417
1> Completed Packing H:\Test\Docs\SpecsProofOfConcept\ExcelDNA2\bin\Release\ExcelDNA2-AddIn64-packed.xll.
1> H:\Test\Docs\SpecsProofOfConcept\ExcelDNA2\bin\Release\ExcelDNA2-AddIn64.dna
1> 1 File(s) copied
1> H:\Test\Docs\SpecsProofOfConcept\ExcelDNA2\bin\Release\ExcelDNA2-AddIn64.xll
1> 1 File(s) copied
========== Build: 1 succeeded, 0 failed, 15 up-to-date, 0 skipped ==========
In my case, it was printing many null reference exceptions in the build output.
It turned out that I had created a console application rather than a class library, and when the NuGet package was added, it created the .dna file pointing to ExcelDNSA2.exe, rather than ExcelDNSA2.dll.
Fix this, and everything worked like a charm.
As mentioned by Mark, you are probably missing some of your dlls, or they aren't being included in the packing.
I've found that you really need to pay attention to the output of the build commands if things aren't working as expected.
The dlls will need to either exist, and be registered on the deployment machine, or will need to be included in your Visual Studio output directory so that the packing includes them. If they can't be found it doesn't flag any error to Visual Studio, it just tells such in the output window.

Wix installer build failure : error CNDL0103: The system cannot find the file

I am trying to create a Wix CustomActions Assembly to set installer properties at msi installation time for my VS2012 c# solution. In the IDE when I right click and build the installer for the web service (OU.Curriculum.ProductService) I get the following error:
The system cannot find the file 'obj\Debug\VantageInstallerCustomActions_Generated.wxs' with type 'Source'. candle.exe OU.Curriculum.ProductService.Installer
The last few lines of the build output shows the following:
2> C:\Program Files (x86)\WiX Toolset v3.8\bin\Heat.exe dir O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\obj\Debug\Package\PackageTmp\ -cg OU.Curriculum.ProductService_Generated -dr INSTALLFOLDER -scom -sreg -srd -var var.OU.Curriculum.ProductService_Generated.Target -gg -sfrag -t O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService.Installer\WsxExcludeWebConfig.xslt -out obj\Debug\OU.Curriculum.ProductService_Generated.wxs
2> C:\Program Files (x86)\WiX Toolset v3.8\bin\Heat.exe project O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\OU.Curriculum.ProductService.csproj -configuration Debug -directoryid INSTALLFOLDER -platform AnyCPU -pog Binaries -pog Symbols -pog Sources -pog Content -pog Satellites -pog Documents -projectname OU.Curriculum.ProductService -ag -sfrag -out obj\Debug\_OU.Curriculum.ProductService.wxs
2> C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe -dVantageInstallerCustomActions_Generated.Target=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\VantageInstallerCustomActions\obj\Debug\Package\PackageTmp\ -d"DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\\" -dSolutionDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\ -dSolutionExt=.sln -dSolutionFileName=OU.Curriculum.Products.sln -dSolutionName=OU.Curriculum.Products -dSolutionPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.Products.sln -dConfiguration=Debug -dOutDir=bin\Debug\ -dPlatform=x86 -dProjectDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService.Installer\ -dProjectExt=.wixproj -dProjectFileName=OU.Curriculum.ProductService.Installer.wixproj -dProjectName=OU.Curriculum.ProductService.Installer -dProjectPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService.Installer\OU.Curriculum.ProductService.Installer.wixproj -dTargetDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService.Installer\bin\Debug\ -dTargetExt=.msi -dTargetFileName=OU.Curriculum.ProductService.Installer.msi -dTargetName=OU.Curriculum.ProductService.Installer -dTargetPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService.Installer\bin\Debug\OU.Curriculum.ProductService.Installer.msi -dOU.Curriculum.ProductService.Configuration=Debug -d"OU.Curriculum.ProductService.FullConfiguration=Debug|AnyCPU" -dOU.Curriculum.ProductService.Platform=AnyCPU -dOU.Curriculum.ProductService.ProjectDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\ -dOU.Curriculum.ProductService.ProjectExt=.csproj -dOU.Curriculum.ProductService.ProjectFileName=OU.Curriculum.ProductService.csproj -dOU.Curriculum.ProductService.ProjectName=OU.Curriculum.ProductService -dOU.Curriculum.ProductService.ProjectPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\OU.Curriculum.ProductService.csproj -dOU.Curriculum.ProductService.TargetDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\bin\ -dOU.Curriculum.ProductService.TargetExt=.dll -dOU.Curriculum.ProductService.TargetFileName=OU.Curriculum.ProductService.dll -dOU.Curriculum.ProductService.TargetName=OU.Curriculum.ProductService -dOU.Curriculum.ProductService.TargetPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\bin\OU.Curriculum.ProductService.dll -dVantageInstallerCustomActions.Configuration=Debug -d"VantageInstallerCustomActions.FullConfiguration=Debug|x86" -dVantageInstallerCustomActions.Platform=x86 -dVantageInstallerCustomActions.ProjectDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\VantageInstallerCustomActions\ -dVantageInstallerCustomActions.ProjectExt=.csproj -dVantageInstallerCustomActions.ProjectFileName=VantageInstallerCustomActions.csproj -dVantageInstallerCustomActions.ProjectName=VantageInstallerCustomActions -dVantageInstallerCustomActions.ProjectPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\VantageInstallerCustomActions\VantageInstallerCustomActions.csproj -dVantageInstallerCustomActions.TargetDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\VantageInstallerCustomActions\bin\Debug\ -dVantageInstallerCustomActions.TargetExt=.dll -dVantageInstallerCustomActions.TargetFileName=VantageInstallerCustomActions.dll -dVantageInstallerCustomActions.TargetName=VantageInstallerCustomActions -dVantageInstallerCustomActions.TargetPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\VantageInstallerCustomActions\bin\Debug\VantageInstallerCustomActions.dll -out obj\Debug\ -arch x86 -ext "C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixUtilExtension.dll" -ext "C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixIIsExtension.dll" obj\Debug\VantageInstallerCustomActions_Generated.wxs Product.wxs obj\Debug\Product.Generated.wxs obj\Debug\_OU.Curriculum.ProductService.wxs
2>candle.exe(0,0): error CNDL0103: The system cannot find the file 'obj\Debug\VantageInstallerCustomActions_Generated.wxs' with type 'Source'.
2>Done building project "OU.Curriculum.ProductService.Installer.wixproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 6 up-to-date, 0 skipped ==========
Here is my solution setup:
I'm struggling to understand why "VantageInstallerCustomActions_Generated.wxs" is being requested and causing the error as I have not included it. I can see it in the output but have no idea what has caused it to be added to the candle.exe cmd line. Any ideas how to remove it ?
Update: I believe it may have something to do with my OU.Wix.targets file:
<Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="BeforeBuild">
<MSBuild Projects="%(ProjectReference.FullPath)"
Targets="Package"
Properties="Configuration=$(Configuration);Platform=AnyCPU"
Condition="'%(ProjectReference.WebProject)'=='True'" />
<PropertyGroup>
<DefineConstants>%(ProjectReference.Filename)_Generated.Target=%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\;</DefineConstants>
<CompilerAdditionalOptions>$(IntermediateOutputPath)%(ProjectReference.Filename)_Generated.wxs</CompilerAdditionalOptions>
<LinkerAdditionalOptions>$(IntermediateOutputPath)%(ProjectReference.Filename)_Generated.wixobj</LinkerAdditionalOptions>
</PropertyGroup>
<HeatDirectory OutputFile="$(IntermediateOutputPath)%(ProjectReference.Filename)_Generated.wxs"
Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\"
Transforms="$(MSBuildProjectDirectory)\WsxExcludeWebConfig.xslt"
DirectoryRefId="INSTALLFOLDER"
ComponentGroupName="%(ProjectReference.Filename)_Generated"
AutogenerateGuids="false"
GenerateGuidsNow="true"
SuppressCom="true"
SuppressFragments="true"
SuppressRegistry="true"
SuppressRootDirectory="true"
ToolPath="$(WixToolPath)"
Condition="'%(ProjectReference.WebProject)'=='True'"
PreprocessorVariable="var.%(ProjectReference.Filename)_Generated.Target"
/>
</Target>
</Project>

Problem with building with csc task in Ant

I have an ant build target using csc:
<target name="compile">
<echo>Starting compiling ServiceLauncher</echo>
<csc optimize="true" debug="true" warnLevel="1"
unsafe="false" targetType="exe" failonerror="true"
incremental="false" mainClass = "ServiceLauncher.Launcher"
srcdir="ServiceLauncher/Launcher/"
outputfile="ServiceLauncher.exe" >
<reference file="libs/log4net.dll"/>
<define name="RELEASE"/>
</csc>
</target>
When I run it, the following exception comes up:
csc failed: java.io.IOException: Cannot run program "csc": CreateProcess error=2, The system cannot find the file specified
However, it runs without the exception but never correctly builds the .exe file, when I manually add in an empty ServiceLauncher.exe.
How can I correctly build this .Net project "ServiceLauncher"?
My guess is that csc.exe is not on the execute path.
From the documentation for the csc task:
csc.exe on Windows or mcs on any other platform must be on the execute path, unless another executable or the full path to that executable is specified in the executable parameter

Categories