dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.55k stars 4.54k forks source link

Compilation in Windows Container fails #104146

Open FlorianRawer-Mahlo opened 1 week ago

FlorianRawer-Mahlo commented 1 week ago

Hey,

at the moment I am trying to compile a software in a windows container with the .net Framework 4.8. The container is built by this dockerfile: https://pastebin.com/cdJp6Pgr

If I start the compilation, the following error occurs: grafik

Does anyone have a idea why it's not working? Thanks

huoyaoyuan commented 1 week ago

.NET Framework specific questions goes to Developer Community.

Your dockerfile includes setup for .NET Framework targeting pack 4.5.2 and above, but the error message indicates targeting pack for 4.0 is required. Targeting packs require exact version match. Can you check if any of your project is still targeting 4.0?

Unfortunately, due to SHA-1 retirement, the older installers of .NET Framework targeting pack are no longer available for download. You can use NuGet-based reference assemblies pack instead. See https://learn.microsoft.com/dotnet/framework/migration-guide/reference-assemblies .

FlorianRawer-Mahlo commented 1 week ago

Alright, i just asked my coworker he has compiled the software on his computer and he has .net 4.8 installed. I have instaled .net with choco but it didnt work, do you know a nother way to install .net in a container or do you know what i did wrong? I used the choco install netfx-4.8 to install it.

huoyaoyuan commented 1 week ago

The .NET Framework runtime and .NET Framework targeting pack are two different things. You need to ensure the targeting pack version. It's installed at C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework. Note that some folders may contain documentations only.

LukasBauer-Mahlo commented 4 days ago

Hey,

can you tell us how to install it? We are not very experienced in combination with the .net installation on docker. On our current CI/CD environments (Static Windows Installations) we still install the Visual Studio Software.

huoyaoyuan commented 4 days ago

See the previous comment https://github.com/dotnet/runtime/issues/104146#issuecomment-2196562493 . Migrating to the NuGet-based reference assemblies seems required, according to https://dotnet.microsoft.com/en-us/download/dotnet-framework/net40 .

dotnet-policy-service[bot] commented 3 days ago

Tagging subscribers to this area: @dotnet/area-meta See info in area-owners.md if you want to be subscribed.