Failing Build because it can't find AL.exe - c#

Here's an interesting problem that really has me scratching my head. I have a project that's being built in TeamCity. It's been working fine until a developer added a resource file to one of the projects with some strings for another locale. He's added the .resx file under the Properties folder next to the default one. Here's the error message from the build log:
C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(2105, 9):
error MSB3091: Task failed because "AL.exe" was not found, or the correct
Microsoft Windows SDK is not installed. The task is looking for "AL.exe" in the "bin"
subdirectory beneath the location specified in the InstallationFolder value
of the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A.
You may be able to solve the problem by doing one of the following:
1) Install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5.
2) Install Visual Studio 2008.
3) Manually set the above registry key to the correct location.
4) Pass the correct location into the "ToolPath" parameter of the task.
There are a number of things here that I can't work out.
- How come it can find AL.exe for the default .resx file but not for this new one?
- Why's it looking in a registry key that looks Vista-specific, when the build is running on Server 2003?
Any ideas?

Problem solved by installing Windows SDK for Windows Server 2008 and .NET Framework 3.5 SP1.
I don't understand how MSBuild got out of step with its tools, perhaps I never will discover the reason, but installing that SDK fixed the problem for me.

Check msbuild from x86 is used. There should be an option in TeamCity build runner.
Was VS2008 installed on the machine?

Make sure the Windows SDK is completely installed on the server. AL.exe (Assembly Linker) is included with the .NET SDK (not the runtime).
(I have the same problem on my TFS server with ClickOnce, but too lazy to fix)

Related

Error File 'MakePri.exe' not found

In Visual Studio 2017, I am building Class Library(Portable) which targets both .Net 4.6 and Windows Universal Application 10.0. While building the application, below error is thrown.
Error  File 'MakePri.exe' not found. See http://go.microsoft.com/fwlink/?LinkID=798187 for more information.
I have done the following
- Installed Latest Windows 10 SDK
- Repaired Visual Studio 2017
- Also in the environment variables, "WindowsSdkDir" is not available
- The path "C:\Program Files (x86)\Windows Kits\10\bin" exists and this file also available
I have used the following post to troubleshoot this issue.
https://social.msdn.microsoft.com/Forums/en-US/8c752e9e-85df-4fee-8026-9b54b6e46be2/vs1517-error-appx1639-missing-file-makepriexe?forum=msbuild
But still there is no luck.
I encountered same problem and after bugging me for a few days i finally managed to fix it. From build logs I saw that VS is not able to find makepri.exe file. In Microsoft.AppXPackage.Targets file variable MakePriExeFullPath is used, so I added new environment variable for my system with that name. For value, i pointed it to the makepri.exe in windows 10 SDK folder, which is on my machine in:
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\MakePri.exe
I had the same issue and I tried everything except reinstall Windows:
Repair VS2017
Install additional SDK
Reinstall SDK
Uninstall VS2017, install SDK, then install VS2017
Uninstall and reinstall VS2017 (in one step)
As mentioned by original poster:
WindowsSdkDir environment variable does not exist
MakePri.exe exists in the right path
Registry entries for Win10 SDK exist in WOW6432 node and point to correct folder.
After a lot of hair pulling I fired up ProcMon (SysInternals) and run a build from VS. I noticed that MSBuild was looking for SDKManifest.xml in every SDK root folder, but that file did not exist in the Win10 SDK root folder.
I copied SDKManifest.xml from another PC with the same Win10 SDK version installed that did not have the issue and it worked.
It is beyond me why after uninstalling everything and installing from scratch, SDKManifest.xml was still missing.
PS: I have many SDKs installed (7.0 through 10.0) most of which were installed with the corresponding VS version. I run VS2008 (Pro), VS2013 (Ent), VS2015 (Ent) and VS2017 (Community) side by side for different projects (some projects, especially SSIS, cannot be migrated to VS2017 without an upgrade to the database engine version). I also have WDK installed for a printer driver development, so all this may be confusing the SDK/VS installer.
Edit: I would be reluctant to alter VS *.target files or add any environment variables and point them to a hard coded path. This will almost certainly break any future SDK installation and does not allow side by side usage of multiple SDK versions
I was having this same problem.
what I solved was I copy an SDKManifest.xml file from the folder of my sdk that was installed in this path "D: \ Windows Kits \ 10"
just copy the SDKmanifest to the project root folder, and it worked normally!

MSBuild only errors on a handful of projects

We have migrated to TFS2012 and VS2012 with an existing solution. My old build controller and TFS used to be on Windows 7, however this server for TFS2012 and our build controller is now Windows 8. The build is giving me the following error:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets
(2401): Task could not find "LC.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
I have seen that a potential fix could be this however the error above is only occurring in specific projects. I thought that this could be down to the .NET framework version, however most projects are on the same version as other projects.
I then did a compare of the project files and noticed that the following attribute was a lower value than a project that worked.
<OldToolsVersion>2.0</OldToolsVersion>
So I updated this to version 4.0 and I still have no luck. Has anyone else experienced this? Is there a work around which doesn't involve me any installations? There must be a setting of some sort that is different as some projects do build and some do not...
TIA.
Guys you know really simple solution. go to asp.net and install the asp.net and tools from downloads page.
htp://www.asp.net/downloads
and every thing will be set and working.

Clickonce - Deploy on DVD, with offline installer

i am using VS 2010 and i am having trouble with clickonce deployment.
My goal is to Distribute application on DVD for users without internet connection to be able to install it. So it needs to include full installer of .NET framework 3.5 Client profile.
However, i am unable to achieve this.
From VS 2010 i choose publish wizard:
Specify location to publish this applicaton:
C:\ something\ something - this folder i will burn later to CD
How will users install application?
From CD{DVD
the application will check for updates from following location:
http://13874.w74.wedos.net/
And that is it, Publish wizard ends here.
So i create some aditional options:
Options->deployment
-Enable autorun for CDs
-Disable creation of publish.htm page
If i publish app, it is deployed to specified folder on my disk and can be installed from there.
But how do i include offline version of .net framework installer (I am Targeting .NET Framework 3.5)?
Thank you.
I managed to found solution for part of my question - how to include offline installer for .NET Framework 3.5. However, second part of my question - how to manage updates remains unanswered.
How to include .NET Framework offline installer for 3.5:
Under prerequisites (Properties->Publish->Prerequisites) make sure you have .Net framework 3.5 SP1 checked
Check radiobutton "Download from same location as my application" in lower part of prerequisities dialog.
Download .NET 3.5 full redistributable here http://go.microsoft.com/fwlink?LinkID=118080
Here comes the main part. It is not enough to just have .net redistributable on same location as your app, there is slightly more to do.
Unpack contents of installer from command line (command - "dotNetFx35.exe /x")
Choose directory to unpack via dialog shown.
Copy CONTENTS of subdirectory WCU\dotNetFramework to
a)x86 systems: %Program Files%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1
b)x64 systems: %ProgramFiles(x86)%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1
In the same locations there should be xml file prduct.xml, edit it as folows:
A) Paste the following into the < PackageFiles > element:
B) Find the element for < PackageFile Name="dotNetFX30\XPSEPSC-x86-en-US.exe" and change the PublicKey value to: 3082010A0282010100A2DB0A8DCFC2C1499BCDAA3A34AD23596BDB6CBE2122B794C8EAAEBFC6D526C232118BBCDA5D2CFB36561E152BAE8F0DDD14A36E284C7F163F41AC8D40B146880DD98194AD9706D05744765CEAF1FC0EE27F74A333CB74E5EFE361A17E03B745FFD53E12D5B0CA5E0DD07BF2B7130DFC606A2885758CB7ADBC85E817B490BEF516B6625DED11DF3AEE215B8BAF8073C345E3958977609BE7AD77C1378D33142F13DB62C9AE1AA94F9867ADD420393071E08D6746E2C61CF40D5074412FE805246A216B49B092C4B239C742A56D5C184AAB8FD78E833E780A47D8A4B28423C3E2F27B66B14A74BD26414B9C6114604E30C882F3D00B707CEE554D77D2085576810203010001
C) Find the element for < PackageFile Name="dotNetFX30\XPSEPSC-amd64-en-US.exe" and change the PublicKey value to the same as in step above
Save the product.xml file
Thats it. Before that, when you attemp to publish it from visual studio it throws errors that it is unable to find variaus parts of .net 3.5 framework. Now it should work fine.
More information at:
http://download.microsoft.com/download/A/2/8/A2807F78-C861-4B66-9B31-9205C3F22252/VS2008SP1Readme.htm#General%20Issues
Section 2.3.1.1. - Enable Samesite for the .NET Framework 3.5 SP1 bootstrapper package

Why can't I install my service (runtime newer than loaded runtime)?

So I built a service in C# and I am trying to use the following command to install it:
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\installutil.exe MyService.exe >> installLog.txt
It fails. When I look at the installLog.txt, I get this:
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.3053
Copyright (c) Microsoft Corporation. All rights reserved.
Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\MyService.exe' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded..
The same approach works fine for installing a different assembly. I feel like it might be because the one that fails was written for .NET 4.0, and the one that works is in 3.5.
Does anyone have any experience with this problem?
You are using the wrong installutil.exe If your application is built against .Net 4.0. Use the the installutil.exe in the 4.0 folder.
For x86:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe
For x64:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe
Nobody even came close to getting this one!
Here's what I had to do:
Right-click the service project in Visual Studio, go to "Properties"
Set "Startup object" to the name of the service (it had been set to the value "(Not Set)").
Save.
Build
Try to install again.
It works! Yay! We can all go home!
Link to the code project article that helped:
For those of you who don't find that this fixes their problem you need to look in the Launch conditions of the .vdproj file and change the .NET framework to 4: http://www.alexjamesbrown.com/uncategorized/deploying-net-4-project-error-1001-system-badimageformatexception/
For me I just right right clicked on the exe I was trying to install and clicked "Unblock"
If you compile on x64 machine, be sure to go into Configuration Mgr and change the build to x64. Of course you'd want to check to make sure you're using the right version of InstallUtil.exe. g'luck.
Having same issue, nothing from above was helping on windows server 2019
tried to run compatibility test, after that the registration suddenly worked:
I believe you provide the answer in your question:
"This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.."
So you might have compiled the runtime with newer functions (which are in newer Frameworks) but the computer you are registrating it on is running a lower version.
Eg. compile for .NET 3.5 but install the service afterwards on a .NET 2.0 wouldnt make sense.
Since you are able to install services on the destination machine, I guess you already are admin. So just upgrade the .NET framework on that service-machine.
Have you tried simply typing MyService.exe /install in a Command Prompt window in the directory containing your Windows service? That has worked for me in the past. You can also uninstall a Windows service by using MyService.exe /uninstall.
I had the same problem. Initially my project was in a very long path on D:\ inside the debug folder of my project.
The problem was solved when I moved the .exe service file to another location with a shorter path and started with "C:\".
I also use this batch file to install the my services
#ECHO OFF
REM Directory for .NET 4. Check for other version directories.
set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319
set PATH=%PATH%;%DOTNETFX2%
echo Installing MyService...
echo ---------------------------------------------------
InstallUtil /i C:\ServiceFolder\MyService.exe
echo ---------------------------------------------------
echo Done.
pause
If you tried all the above and still see the same error, double check if you have a 32-bit application or any 32-bit DLLs and your server is a 64-bit server.
Wasted an hour on this,all I had to do was add quotes for the service path.
Step 1) cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
add the directory of the .exe path in quotes as shown
step 2) InstallUtil.exe "E:\MyNewService\MyNewService\bin\Debug\MyNewService.exe"
ref: https://www.codeproject.com/Answers/5143174/Installing-windows-service-error-installutil-exe-i#answer5

Required file 'alink.dll with IAlink3'

I was trying to build a C# solution on my Visual Studio 2008, that is running on a Windows Vista machine, but when I try to build it I'm getting this error:
Required file 'alink.dll with IAlink3' could not be found Amigo X
"Amigo X" is the name of the solution. What is wrong?
PS: Amigo X is a party that we have here in Brazil at the christmas, it's at the time to gave presents to your family. ;)
You are using a C# 3.0 compiler on a machine which does not have CLR 2.0 SP1 installed. Try manually installing 2.0 SP1 and seeing if that fixes the problem.
This is a simple problem and there is an easy fix.
1. Open project properties.
2. In the Application tab, find the Manifest dropdown. choose the option 'Create application without a manifest'
3. Run the application successfully.

Categories

Resources