I have a build on TeamCity that packages a web project ready for later deployment, currently using MSBuild 2013. When I pushed some code recently I got build errors (due to the fact that I was using some C# 6 features) so I went to change the build configuration to use MSBuild 2015 instead and got this error:
[Error] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets(132, 5): Can't find the valid AspnetMergePath
This error has been mentioned in other questions before (such as here: VS 2012 Publish: Can't find the valid AspnetMergePath) but unfortunately none of the fixes mentioned in those questions have worked for me.
Things I have already tried or were already the case:
Web and WebApplication directories from local machine (at C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0) have been copied up to build server (they've always been there)
Added
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\</TargetFrameworkSDKToolsDirectory> to
Microsoft.Web.Publishing.AspNetCompileMerge.targets file
Added /p:AspnetMergePath="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\" to MSBuild command
I'm at a bit of a loss with this one: pretty much the only thing I haven't tried is installing Visual Studio on the build server, but I'd really like to avoid that if I can (because I think it's ridiculous that you should have to install a full IDE on a CI server!).
Some further info:
everything continues to work just fine if you switch the build back to MSBuild 2013 (although, obviously, we don't want to get stuck in the past)
we have a number of other pure compilation builds that are running against MSBuild 2015 with no errors
Both the second and the third solution originally proposed on VS 2012 Publish: Can't find the valid AspnetMergePath actually do work, but the right version of the SDK tools has to be provided.
The original article (VS 2012 Publish: Can't find the valid AspnetMergePath) was written in 2013 and covers the Visual Studio 2012. The aspnet_merge.exe that supports C# 6.0 and .NET 4.6 is not the one that is found under the path "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\".
In order to get the third solution work, use the following path instead "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\".
In oder words, adding /p:AspnetMergePath="C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\" to MSBuild command solves the problem.
My team had exactly the same issue as the one you are describing and adding this parameter to the MSBuild step immediately fixed it. (I assume of course that you have the NETFX 4.6 version of the tools on your build machine.)
As a side note, since you said that you use Team City - instead of adding the above parameter directly as a command line parameter, you can use the Team City recommended and configure the corresponding build parameter.
The accepted answer is just symptom treatment and doesn't address the underlying issue. Please run MSBuild with diagnostic logging. If you look at the Microsoft.Web.Publishing.AspNetCompileMerge.targets you will see that it attempts to concatenate TargetFrameworkSDKToolsDirectory with AspnetMergeName. If you search in your MSBuild log, you will find that TargetFrameworkSDKToolsDirectory is empty. TargetFrameworkSDKToolsDirectory is build from TargetFrameworkSDKDirectory which is also empty.
That is what you need to fix. In my case:
Install the Windows 7.1 SDK (using this workaround on Windows Server 2016).
In VS2017 the path is determined based on /configuration/msbuildToolsets/toolset/property[#name="FrameworkSDKRoot] which is in my case Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK\4.6.1#InstallationFolder. In my case this node was only available in the WOW6432Node, it needs to be available in the 64-bit registry too. You need to copy the node to the equivalent location in the 64-bit registry.
Related
I'm setting up Visual Studio Code to write and learn C#.
I'm not able to find and use the latest version of C# compiler with Visual Studio Code.
Enquiring enquiring my compiler version with the Visual Studio Code terminal command csc -langversion:? brings up the following error message:
csc : The term 'csc' is not recognized as the name of cmdlet,
function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and
try again.
My previous attempts in solving the problem
Having searched intensely, I have found out this:
When using Visual Studio, this problem doesn't even occur. Visual Studio apparently contains the necessary .NET SDK and compiler and uses it automatically.
I should locate the csc.exe file and set it as an environment variable path.
The only csc.exe files I find are located in the directory:
C:\Windows\Microsoft.NET\Framework64\v x.x.xxxxx with the latest being version being 4.0.30319.
All the instructions I could find suggested using this folder to be set as an environment variable path.
I do that. I now try again in Visual Studio Code: csc -langversion:?
Now I get the following message:
Microsoft (R) Visual C# Compiler version 4.8.4084.0 for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.
This compiler is provided as part of the Microsoft (R) .NET Framework,
but only supports language versions up to C# 5, which is no longer the
latest version. For compilers that support newer versions of the C#
programming language, see
http://go.microsoft.com/fwlink/?LinkID=533240
warning CS2008: No source files specified error CS1617: Invalid option
'?' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default"
So the csc.exe I was referring and have set as an environment variable path is outdated. I would, however, like to get all the modern features of C# 9.
I tried again to find the latest compiler from the folder "C:\Program Files\dotnet", but I could only find a folder, "Roslyn", which, to my understanding, refers to the newest versions of csc. I couldn't find any csc.exe in these folders.
The solutions?
Now should I find the latest csc.exe supporting C# 9 from somewhere (where?) and set it up as an environmental variable path?
Or am I on the wrong track here?
Or is the only choice that I give up Visual Studio Code completely and switch to Visual Studio (I wouldn’t want to do that). But that can't be the only solution!
Background information
I am a total beginner to the world of coding.
I have installed the latest version of .NET SDK 5.0.302.
I have installed the following extensions in my Visual Studio Code instance:
C# (MS)
.NET Install Tool for Extension Authors (MS),
C# XML Documentation Comments (Keisuke Kato)
ilspy-vscode (SharpDevelop Team)
MSBuild project tools (tintoy)
REST Client (Huachao Mao)
You should use the dotnet command in your console to build and run a .NET 5 application.
Try to install the C# extension in your Visual Studio Code.
The crucial piece of findings:
Using statement:
#error version
produces detailed information about the compiler in use. It returned the same version number for the compiler as if I wouldn't have defined the Roslyn folder under the .vscode as PATH in the environment variables.
Therefore I think I can safely conclude this:
Visual Studio Code doesn't show you the current compiler with the call csc -langversion:? unless you add the aforementioned Roslyn folder under .vscode as a PATH on environmental variables.
However, it does seem that Visual Studio Code uses this particular compiler anyway, even though it doesn't formally recognise it. So the only thing that is really important is to install the latest .NET SDK.
I did the following and it worked.
I went to My Computer → Properties → Advanced System Settings → Environment Variables → double clicked on "Path" → Add new → pasted the directory where you can find csc.exe and clicked OK.
I restarted Visual Studio Code and it worked. The directory where I found csc.exe for me was:
C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\csc
TL;DR: Clean Windows build server, MS Build Tools 2019 and TFS 2013 installed.
Build Logs says Exception Message: File not found: MSBuild.exe (type FileNotFoundException)
How Do I setup MSBUILD toolpath in a XAML file on TFS 2013, configured to use MSBuild 2019 with a Visual Studio 2019 Enterprise installed on my dev box.
Please provide FULL XAML file that WORKS with TFS2013 (update 3) with an explicit custom msbuild path.
A Bit more info:
We have a multi server setup for our TFS build routines running version 2013.
One controller and a few agent servers here and there, nothing fancy.
Recently I added yet another for GUI Testing - I need the agent service to be in Interactive mode.
Steps so far:
Installed TFS 2013 including two agents - linking to the main controller.
I install Build Tools version 2019
I added tags to control the build destribution.
Activated a build and the rest is history.
I'm four (frustrating) days in on this - I've read every Stack Overflow TFS set toolpath entry I can find, and a huge bunch of odd forums, yet none seems to scratch my itch here.
I even added both paths you see further down, to the Windows environment PATH variable. Im not sure that does anything anymore.
See; Everybody talks about this entry in the XAML that says toolpath (or similar) - but; I dont see it. We use a minor changed version of a TfvcTemplate.12.Xaml.
Many also talk about this GUI tool for editing XALM files, where I get to see all the different options available (I presume) - can someone help me with this too? Its certainly not working out of the box with a 2019 Enterprise????
So; I installed this Extension Process Template Editor, but of course nothing happens when I click a XAML file, just more XML :)
I now have a few added paths on the new server, where I see instances of msbuild.exe installed (MS/.NET get your act together, please)
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
C:\Program Files (x86)\MSBuild\12.0\Bin
Please try not to write this off as a duplicate at first glance. I know its similar to other questions - however; Devil is in the details.
Set toolpath to MSBuild 2019 in a TFS 2013 using (XALM) build process templates
Just as you know, the Old Visual Studio versions installed msbuild into C:\Program Files (x86)\MSBuild\<version>\bin and apparently the RunMSBuild activity used the ToolVersion + the ToolArchitecture to calculate this path.
VS 2019 build tool instead installs it C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin and the RunMSBuild can't calculate the proper path anymore. You can not use the old DefaultTemplate12.xaml to integrate with VS2019 build tool.
To make this work, you could try to modify the TFSBuildServiceHost.exe.config and you must have a version of VS 2019 build tool or VS2019 installed on the build server in order for this to work.
More detail step please follow Jonesy2488's answer in this link:How to get VS 2017 working with TFS 2017 XAML Builds.
Besides, we could also try to use MSBuild task instead of Visual Studio Build task, then specify the location of MSBuild 16.0:
Hope this helps.
I made it work by changing ToolVersion for mtba:RunMSBuild in TfvcTemplate.12.xaml to the required version and adding MSBuildToolsPath to Windows Registry.
Registry settings for 15.0 and 16.0
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.0]
"MSBuildToolsPath"="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\amd64"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\16.0]
"MSBuildToolsPath"="C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\amd64"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\15.0]
"MSBuildToolsPath"="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\16.0]
"MSBuildToolsPath"="C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin"
I installed the Visual Studio Build Tools 2017 using the link (at bottom under Other Tools and Frameworks) installing both workloads: Visual C++ build tools and Web development build tools. I kept the default folder.
Based on quite a few articles, such as Microsoft Web Application Targets is Missing, I expected to see vs_buildtools.exe in the folder: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin folder, but no. I see MSBuild.exe, as you can see from this screenshot.
Here is a screenshot of the installer.
Really, there are quite a few articles saying the exact same thing: 1, 2, to name only 2.
How do I get vs_buildtools.exe?
Apparently the only way to solve my Microsoft induced Web Application Targets missing problem, as it is no longer in 15.0 is to use this executable and run the vs_buildtools.exe --add Microsoft.VisualStudio.Workload.WebBuildTools as the answer specifies. I am also annoyed now that something that should be there is not. Did Microsoft change something in a newer revision of the Build Tools?
How do I get vs_buildtools.exe?
You have already got the vs_buildtools.exe.
I installed the Visual Studio Build Tools 2017 using the link (at bottom under Other Tools and Frameworks) installing both workloads
You will notice that the installed file name is vs_buildtools__339506979.1501125082.exe, which include the version info in the name. You can rename it to vs_buildtools.exe, that is what you want.
Update for vs_buildtools.exe:
After use the command:
vs_buildtools.exe --add Microsoft.VisualStudio.Workload.WebBuildTools
The WebBuildTools will be installed at:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications
Besides, be aware that the comment under the answer:
If you already have downloaded the "Build Tools for Visual Studio
2017" installer
(visualstudio.com/thank-you-downloading-visual-studio/…), then you can
launch that installer, hit Modify and tick the "Web development build
tasks" workload module checkbox. Then click the Modify button and let
the installer finish.
I have a solution with an Azure cloud project in it that's targeting the 2.7 version of the Microsoft Azure SDK which I could open/build and deploy without problems. Since Visual Studio was nagging me to update, I went ahead and installed the new Azure SDK version of 2.9. After that update, I cannot open the cloud project files, and Visual Studio (2015 Community edition, now fully updated to the latest as of the time I'm writing this) gives me this error message:
MyTest.ccproj : error : The type initializer for 'Microsoft.Cct.CctProjectNode' threw an exception.
I am able to open the project if I manually edit the ccproj file and change the
<ProductVersion>2.7</ProductVersion>
value to 2.9. However, I can not use that, since other people are working on this project and they still want to remain on the 2.7 version of the Azure SDK, which is also currently deployed to production.
Is there a way to allow Visual Studio to open older versions of cloud projects? Do I have to uninstall the Azure SDK updates?
Thank you all!
There is an issue with the SxS compatibility for 2.9.5 and previous versions. This is very recently discovered and we are looking into a fix for the next version, but until then you will have to uninstall 2.9.
Uninstall the “Microsoft Azure tools for Microsoft Visual Studio
2015 – v2.9” from add/remove programs
Run msiexec /x {60473BF2-359B-43B3-AF6C-12BAC6C5BC3F}. (For VS 2013, use
{438EED24-F35B-44E0-A2E2-675838273002}) This should bring up the msi
dialog to uninstall “Microsoft Azure Tools for Microsoft Visual
Studio 2015 Core”
In add/remove programs, repair Microsoft Azure Tools for Microsoft Visual Studio 2015 – v2.7 (or v2.8 for people using that version).
Updating answer. The most common GUIDs for #2 are :
{60473BF2-359B-43B3-AF6C-12BAC6C5BC3F}
{438EED24-F35B-44E0-A2E2-675838273002}
If you get an error "This action is only valid for products that are currently installed." try using {8664E001-704C-4EFB-B68D-6A3DEF60BBEE}.
The MSFT Support forum on this is here
Connect ticket is here
Solution:
Uninstall the “Microsoft Azure tools for Microsoft Visual Studio 2015 – v2.9” from add/remove programs and any other v 2.9 components
Run “msiexec /x {60473BF2-359B-43B3-AF6C-12BAC6C5BC3F}” or {8664E001-704C-4EFB-B68D-6A3DEF60BBEE}. (For VS 2013, use {438EED24-F35B-44E0-A2E2-675838273002}) This should bring up the msi dialog to uninstall “Microsoft Azure Tools for Microsoft Visual Studio 2015 Core”
In add/remove programs, repair Microsoft Azure Tools for Microsoft Visual Studio 2015 – v2.7 (or v2.8 for people using that version).
Exceptions:
In certain situations this might not be enough. Still, there are solutions for these exceptions also. If you still get the error message you might want to have a clean install. To do that please use the following command:
Get-WmiObject -Class win32_product | Out-File c:\temp\.txt
This will create a file in the location you specified with all packages installed on your computer. Search through that file and use:
msiexec /x <any GUID you think necessary>
You can check here what are the components the 2.8 (if that is the case for you) package contains so you would know what you should or should not have:
https://www.microsoft.com/en-us/download/details.aspx?id=50041
After removing everything you should reinstall 2.8.2 using the web package installer and check if that works.
More Exceptions:
At this point the original issue should be gone but you might run into one of the following errors I pasted at the end of the article. For the first error you should register the assembly. You can list the assemblies using:
gacutil -l >yourassemblies.txt
Simply open the Developer Command Prompt (available in Start Menu>App>Visual Studio) and run the command.
The dll can be found here:
C:\Program Files\Microsoft SDKs\Azure
You can register it using the same prompt with this command:
gacutil /i yourdll.dll
For the second exception:
Use procmon from here:
https://technet.microsoft.com/en-us/sysinternals/bb896645
Find the path that Visual Studio is searching in by capturing the VS process (devenv) while reproducing the error.
Copy the files from here:
C:\Program Files\Microsoft SDKs\Azure\Emulator
to the path you discovered.
See also:
Cannot run Windows Azure project due to Error: Unable to find fileDFUI.exe please verify your install is correct
Assembly:
The "DeleteCurrentDeployment" task failed unexpectedly.System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ServiceHosting.Tools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.File name: 'Microsoft.ServiceHosting.Tools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.Cct.Debugging.DevFabricService..ctor() at Microsoft.Cct.CctProjectNode.<>c.b__121_0() at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Func1 valueFactory) at System.Threading.LazyInitializer.EnsureInitialized[T](T& target, Func1 valueFactory) at Microsoft.Cct.CctProjectNode.get_DevFabricService() at Microsoft.Cct.CctBuildDeploymentTaskHost.DeleteCurrentDeployment() at Microsoft.CloudExtensions.MSBuildTasks.DeleteCurrentDeployment.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()WRN: Assembly binding logging is turned OFF.To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.Note: There is some performance penalty associated with assembly bind failure logging.To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Missing file:
The "DeleteCurrentDeployment" task failed unexpectedly.Microsoft.ServiceHosting.Tools.DevelopmentFabric.DevFabricException: Unable to find file 'DFUI.exe' please verify your install is correct. at Microsoft.ServiceHosting.Tools.Utility.ProcessWrapper.ResolveBinaryFullPath(String binaryName) at Microsoft.ServiceHosting.Tools.Utility.ProcessWrapper..ctor(String binaryName, String arguments, Boolean breakAway) at Microsoft.ServiceHosting.Tools.DevelopmentFabric.DevFabric..ctor(Boolean singleInstance) at Microsoft.Cct.Debugging.DevFabricService..ctor() at Microsoft.Cct.CctProjectNode.<>c.b__121_0() at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Func1 valueFactory) at System.Threading.LazyInitializer.EnsureInitialized[T](T& target, Func1 valueFactory) at Microsoft.Cct.CctProjectNode.get_DevFabricService() at Microsoft.Cct.CctBuildDeploymentTaskHost.DeleteCurrentDeployment() at Microsoft.CloudExtensions.MSBuildTasks.DeleteCurrentDeployment.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
Today a new SDK 2.9.6 was released click
Maybe someone with this problem could try to install it and tell if proplems are solved without the need of other solutions.
I had to run msiexec /x {8664E001-704C-4EFB-B68D-6A3DEF60BBEE} to get this to work.
I tried commenting by lack the 50 points as well - sorry.
I was able to get the project loading by editing the project file and changing the SDK version to 2.9. At least then I could debug. It's a workaround while waiting, and so you don't mess up your machine uninstalling/reinstalling different SDKs. YMMV. Modify the following sections of the project file and reload:
First, change to 2.9 from 2.8:
<ProductVersion>2.9</ProductVersion>
Then, in , same thing, as follows:
<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Windows Azure Tools\2.9\</CloudExtensionsDir>
I hope that helps! Worked for me :)
install 2.8 sdk along with 2.7 already installed. This solved my prob
I saw "user6258895" already have this solution. I just like to add some more:
I had the same problem. After installing Microsoft Azure SDK for .Net (Your Visual Studio Version) -- Take latest SDK Version, my solution is working fine.
The below tools i have installed for my Visual studio ultimate 2013. If you want you can download as per your visual studio version.
First try to install/repair "Microsoft Azure SDK for .Net (Your Visual Studio Version) -- Take latest SDK Version". See is it working or not.
Microsoft.Azure.HDInsightToolsForVS2013.msi
MicrosoftAzureAuthoringTools-x64.msi
MicrosoftAzureComputeEmulator-x64.exe
MicrosoftAzureLibsForNet-x64
MicrosoftAzureQuickstarts.msi
MicrosoftAzureStorageEmulator.msi
MicrosoftAzureStorageTools.msi
MicrosoftAzureTools.VS110.exe --For VS 2012
MicrosoftAzureTools.VS120.exe --For VS 2013
MicrosoftAzureTools.VS140.exe -- --For VS 2015
VWDOrVs2013AzurePack.exe ---Try to install it first to see, if it works.
WebToolsExtensionsVS2013.msi
Or you can google by Microsoft Azure SDK for .NET - 2.6 (Use your required version)
N.B: Change the version according to your PC/VS configuration.
Thank you.
I have cloned a project to my computer using TFS, when I build the project I get this error :
Error 6 Task could not find "LC.exe" using the SdkToolsPath "" or the
registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft
SDKs\Windows\v8.1A\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
I have searched the web but couldn't find a solution. I use VS 2013 and .NET 4.
How can I fix this? Thanks.
If you're using MSBuild.exe to build projects from the command line, you can pass TargetFrameworkSDKToolsDirectory as a parameter to avoid having to edit your .csproj files.
For example:
MSBuild.exe mysolution.sln /t:build /p:TargetFrameworkSDKToolsDirectory="C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools"
It turns out you can specify the path to the SDK directly in the .csproj file:
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools</TargetFrameworkSDKToolsDirectory>
and the build found lc.exe that way.
So do a dir /s for lc.exe and use that path.
I previously expected to set this using <SdkToolsPath>, but that didn't work. In Microsoft.Common.targets, SdkToolsPath gets set from TargetFrameworkSDKToolsDirectory, so I tried that and it worked. (It would be nice if the variable name corresponded 1 to 1, but they don't.)
This is on Visual Studio 2015, and msbuild being called from ant.
I was having the same problem and resolved it by re-installing the Visual Studio.
http://msdn.microsoft.com/en-us/library/ha0k3c9f(v=vs.110).aspx
The License Compiler reads text files that contain licensing
information and produces a binary file that can be embedded in a
common language runtime executable as a resource. A .licx text file is
automatically generated or updated by the Windows Forms Designer
whenever a licensed control is added to the form. As part of
compilation, the project system will transform the .licx text file
into a .licenses binary resource that provides support for .NET
control licensing. The binary resource will then be embedded in the
project output. Cross compilation between 32-bit and 64-bit is not
supported when you use the License Compiler when building your
project. This is because the License Compiler has to load assemblies,
and loading 64-bit assemblies from a 32-bit application is not
allowed, and vice versa. In this case, use the License Compiler from
the command line to compile the license manually, and specify the
corresponding architecture. This tool is automatically installed with
Visual Studio. To run the tool, use the Developer Command Prompt (or
the Visual Studio Command Prompt in Windows 7). For more information,
see Visual Studio Command Prompt.