@@ -44,52 +44,61 @@ jobs:
44
44
uses : microsoft/setup-msbuild@v1
45
45
- name : Setup NuGet
46
46
uses : NuGet/setup-nuget@v1
47
- - name : Install .NET Framework Developer Packs
47
+ - name : Download and Install .NET Framework Reference Assemblies
48
48
run : |
49
- # Install .NET 4.5.1 developer pack (closest available to 4.5)
50
- echo "Installing .NET 4.5.1 developer pack (closest to 4.5)..."
51
- choco install netfx-4.5.1-devpack -y || echo "4.5.1 installation failed"
49
+ # Create temp directory
50
+ New-Item -ItemType Directory -Path "temp_ref_assemblies" -Force
52
51
53
- # Also try 4.5.2 as additional fallback
54
- echo "Installing .NET 4.5.2 developer pack as additional option ..."
55
- choco install netfx-4.5.2-devpack -y || echo "4.5.2 installation failed "
52
+ # Download .NET 4.0 Reference Assemblies
53
+ echo "Downloading .NET 4.0 Reference Assemblies ..."
54
+ Invoke-WebRequest -Uri "https://www.nuget.org/api/v2/package/Microsoft.NETFramework.ReferenceAssemblies.net40/1.0.3" -OutFile "temp_ref_assemblies/net40_ref.zip "
56
55
57
- # Try .NET 4.0.3 but don't fail the build if it doesn't work
58
- echo "Attempting to install .NET 4.0.3 developer pack ..."
59
- choco install netfx-4.0.3-devpack -y || echo "4. 0.3 installation failed, continuing anyway... "
56
+ # Download .NET 4.5 Reference Assemblies
57
+ echo "Downloading .NET 4.5 Reference Assemblies ..."
58
+ Invoke-WebRequest -Uri "https://www.nuget.org/api/v2/package/Microsoft.NETFramework.ReferenceAssemblies.net45/1. 0.3" -OutFile "temp_ref_assemblies/net45_ref.zip "
60
59
61
- # Show what we have available
62
- echo "Checking installed targeting packs..."
63
- if (Test-Path "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework") {
64
- dir "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework"
60
+ # Extract and install .NET 4.0
61
+ echo "Installing .NET 4.0 Reference Assemblies..."
62
+ Expand-Archive -Path "temp_ref_assemblies/net40_ref.zip" -DestinationPath "temp_ref_assemblies/net40" -Force
63
+ if (Test-Path "temp_ref_assemblies/net40/build/.NETFramework/v4.0") {
64
+ Copy-Item -Path "temp_ref_assemblies/net40/build/.NETFramework/v4.0" -Destination "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\" -Recurse -Force
65
+ echo "✓ .NET 4.0 Reference Assemblies installed"
66
+ }
67
+
68
+ # Extract and install .NET 4.5
69
+ echo "Installing .NET 4.5 Reference Assemblies..."
70
+ Expand-Archive -Path "temp_ref_assemblies/net45_ref.zip" -DestinationPath "temp_ref_assemblies/net45" -Force
71
+ if (Test-Path "temp_ref_assemblies/net45/build/.NETFramework/v4.5") {
72
+ Copy-Item -Path "temp_ref_assemblies/net45/build/.NETFramework/v4.5" -Destination "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\" -Recurse -Force
73
+ echo "✓ .NET 4.5 Reference Assemblies installed"
65
74
}
66
75
67
- # Debug: Check what's actually inside v4.5 folder
68
- echo "Checking v4.5 folder contents ..."
69
- if (Test-Path "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5 ") {
70
- dir "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5 "
76
+ # Verify installations
77
+ echo "Verifying installations ..."
78
+ if (Test-Path "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll ") {
79
+ echo "✓ .NET 4.0 mscorlib.dll found "
71
80
} else {
72
- echo "v4.5 folder does not exist!"
81
+ echo "✗ .NET 4.0 mscorlib.dll missing"
82
+ }
83
+ if (Test-Path "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll") {
84
+ echo "✓ .NET 4.5 mscorlib.dll found"
85
+ } else {
86
+ echo "✗ .NET 4.5 mscorlib.dll missing"
73
87
}
74
88
75
- # Debug: Check MSBuild targeting pack environment
76
- echo "MSBuild targeting pack environment..."
77
- echo "TargetFrameworkRootPath: $env:TargetFrameworkRootPath"
78
- echo "MSBuildExtensionsPath32: $env:MSBuildExtensionsPath32"
89
+ # Show what we have available now
90
+ echo "Final targeting pack listing..."
91
+ if (Test-Path "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework") {
92
+ dir "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework"
93
+ }
94
+
95
+ # Cleanup
96
+ Remove-Item -Path "temp_ref_assemblies" -Recurse -Force
79
97
continue-on-error : true
80
98
- name : Restore NuGet packages
81
99
run : nuget restore ./OptimizelySDK.NETFramework.sln
82
100
- name : Build & strongly name assemblies
83
- run : |
84
- echo "=== MSBuild Diagnostics ==="
85
- echo "Attempting build with verbose logging to diagnose targeting pack resolution..."
86
- msbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk /p:Configuration=Release /verbosity:diagnostic /flp:logfile=msbuild.log ./OptimizelySDK.NETFramework.sln
87
-
88
- echo "=== Build completed, checking for targeting pack errors in log ==="
89
- if (Test-Path "msbuild.log") {
90
- echo "Searching for targeting pack related messages..."
91
- Select-String -Path "msbuild.log" -Pattern "(TargetFramework|Reference.*Assemblies|MSB3644|v4\.5)" | Select-Object -First 20
92
- }
101
+ run : msbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk /p:Configuration=Release ./OptimizelySDK.NETFramework.sln
93
102
- name : Install & Run NUnit tests
94
103
run : |
95
104
nuget install NUnit.Console -Version 3.18.1 -DirectDownload -OutputDirectory .
0 commit comments