0

I can't successfully build basic ASP.NET web app targeting framework 4.7.2. I built a docker image with a base image for Windows Server Core 2019. On this image I installed VS 2022 Enterprise and took Azure development, .NET desktop development, ASP.NET and web development modules, including recommended ones. For dotnet core solutions everything works fine, but for dotnet framework I am getting such errors:

packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(31,5): Error MSB3758: An error has occurred during compilation. error CS0014: Required file 'alink.dll' could not be found

packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(31,5): Error MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Build.Tasks.Core.dll". The task factory must return a value for the "TaskType" property.

I additionally installed .NET Frameworks: 4.5, 4.6, 4.6.1, 4.7.1, 4.8, but it didn't help. Locally, I am able to build it without any problems. I checked the image if VS 2022 was installed without any issues and it looks fine as well. All environment variables are also in place. I thought the issue was related with some missing .NET Frameworks with SDKs, but it still persists.

Installing Redistributable C++ 2012-2022 didn't help as well. I am using MSBuild 17. What I still might be missing?

I want to create an agent for Azure DevOps and as a reference I use the Dockerfile from Microsoft documentation. One difference is that before the start script, I run my custom script to silently install the VS 2022 with the modules I specified earlier. I use Azure DevOps pipelines to build the solution, and the VSBuild@1 task.

7
  • What's the issue your are facing while you build on the docker? How's the dockerfile look like?
    – Chetan
    Feb 9, 2022 at 23:33
  • Did you install the runtimes or the sdks?
    – David L
    Feb 9, 2022 at 23:53
  • I added an update for a better context. I have installed all sdks with targeting packs: 4.5, 4.6, 4.6.1, 4.7.1, 4.7.2, 4.8. From VS, 4.8 runtime installed
    – Mike26
    Feb 10, 2022 at 0:13
  • I assume something else might be missing. Please notice that I start from base win server core and I install most of the tools from VS installer. The issue is I can't build asp.net basic web apps because I receive the error with missing alink.dll or assembiles from Microsoft.Build.Tasks.Core.dll
    – Mike26
    Feb 10, 2022 at 0:19
  • Why did you install Visual Studio in the Docker image? That really shouldn't be necessary. Nor should installing C++ components. Just put the build artifacts (DLL's, CSS, JS, etc) in the image. And start with the correct base image. Windows Server Core would be a pretty barebones one. For an ASP.NET app, you need one with IIS and .NET framework already installed. Use mcr.microsoft.com/dotnet/framework/aspnet.
    – mason
    Feb 10, 2022 at 2:26

1 Answer 1

1

I was finally able to solve the problem I had. It turned out that the base windows server core image didn't contain all of the needed prerequisites nor Visual Studio. Solution was to use extended windows server core image with sdk 4.8. This is strange, because Visual Studio already delivers everything for sdk 4.8. I think the extended image must have had something else that didn't come with the VS installation.

2
  • Had the same issue, and the base image with 4.8 SDK fixed it for me too. Aug 24, 2022 at 0:08
  • Hi, Can you please share the command to use extended windows server core image with sdk 4.7.2. Thanks !
    – user684805
    Sep 19, 2022 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.