1

I have a project developed in 4.0 framework and it is working fine when running with visual studio. But when i execute the same project with MSBuild in command prompt , the project not getting build which shows error of "Al.exe is not found"

"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\Msbuild.exe"

The above issue occurs only if the project contains resource files and build with msbuild through command prompt.

The msbuild command runs through process start methods using the below code,

ProcessStartInfo psi = new ProcessStartInfo();

psi.FileName = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Msbuild.exe";

psi.Arguments = "D:\Samples\Localization\cs\LocalizationDemo_2010.csproj" /p:Configuration=Release /nologo /noconlog /fileLogger /fileloggerparameters:logfile="D:\Samples\Localization\cs\build.log";

Process p = Process.Start(psi);

Please anyone help me if you have any ideas about this.

Regards,

Amal Raj

Amal
  • 576
  • 1
  • 6
  • 26
  • Show the entire error message please – Ofir Winegarten Jan 23 '17 at 10:53
  • @OfirW error MSB3086: Task could not find "AL.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed – Amal Jan 23 '17 at 11:22
  • Did you install the Windows SDK ? http://www.microsoft.com/downloads/details.aspx?familyid=6B6C21D2-2006-4AFA-9702-529FA782D63B&displaylang=en – Ofir Winegarten Jan 23 '17 at 11:33
  • i have installed all .net frame work versions upto 4.6 . i could not find windows sdk for windows 7 and 4.0 – Amal Jan 23 '17 at 11:54
  • You're on windows 8? check this: https://developer.microsoft.com/en-us/windows/downloads/windows-8-sdk – Ofir Winegarten Jan 23 '17 at 12:00
  • i am windows 10 – Amal Jan 23 '17 at 12:05
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/133802/discussion-between-ofirw-and-amal). – Ofir Winegarten Jan 23 '17 at 12:06
  • Do you run this from a developer command prompt? – stijn Jan 23 '17 at 19:01
  • @stijn - Yes, i run the project in command prompt with msbuild – Amal Jan 24 '17 at 05:26
  • edited the question, as the failure occurs only for projects with resource files in msbuild execution – Amal Jan 24 '17 at 06:19
  • If you run the command prompt you shouldn't specify the full path to msbuild, it should be in the search path? Idem for al.exe. If you start the correct VS command prompt and ttype `al` it should run AL. Does it? Also your edit raises a new question: does it work if you run msbuild /path/to/project directly instead of programmatically? – stijn Jan 24 '17 at 08:10
  • @stijn - I think this issue is not with path or arguments. This issue occurs only in machine installed with VS2017 only. And the same project works fine in machine installed with VS2010, VS2012, VS2013, VS2015 – Amal Jan 24 '17 at 09:05
  • Please refer to the error log C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2863,5): error MSB3086: Task could not find "AL.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86". Could anyone please let me know, how to register the 8.0A with Al.exe as recommened? – Amal Feb 01 '17 at 11:41
  • 1
    Here's a stupid tip: I had the exact same issue, but with .NET 2.0 projects. I was missing the Individual Component ".NET Framework 3.5 development tools" in the VS setup. Installing them fixed it. – Ray Mar 14 '17 at 16:02

1 Answers1

2

Ensure that your command line invocation of MSBuild uses the same set of build assemblies that your version of Visual Studio uses. You did not specify what version of Visual Studio you are using, but in any case this should set you in the right direction:

  1. In Visual Studio, set the following to Diagnostic: Tools->Options->Projects and Solutions->Build and Run->"MSBuild project build output verbosity".
  2. Build the project and then search the Output window's Build pane for MSBuildToolsPath.
  3. Use that property's value (e.g. C:\Program Files (x86)\MSBuild\14.0\bin) as the path to msbuild.exe when you build from the command line.

EDIT Now that we know you are using VS 2017 RC, and with credit to https://stackoverflow.com/a/40702534/704808, search for msbuild.exe under %programfiles(x86)%\Microsoft Visual Studio\2017\.

Community
  • 1
  • 1
weir
  • 4,521
  • 2
  • 29
  • 42
  • I am using VS2017 RC – Amal Feb 02 '17 at 04:48
  • What should i do after Tools->Options->Projects and Solutions->Build and Run->"MSBuild project build output verbosity". Could not find the MSBuildToolsPath in build pane of Output window ? – Amal Feb 02 '17 at 09:40
  • There is no 14.0 folder exists under msbuild for machine installed with VS2017 alone. – Amal Feb 06 '17 at 04:53
  • I know:). Just do a recursive search for msbuild.exe under the path I specified in my edit at the bottom of my answer. – weir Feb 06 '17 at 11:06