Closed nioncode closed 8 years ago
Pull requests to fix this welcomed. Were you able to solve it?
I solved it by disabling the entire script from running, because I didn't need it, anyway.
As I said in my previous post, the ngen.exe is at '%windir%\microsoft.net\framework\v2.0.50727\ngen.exe' (and framework64) on a fresh Windows 7 installation with .NET Framework v3.5.
To fix the issue, you could check if the v4.0.30319 folder exists and if it does not, then the script should use the older one in v2.0.50727.
I applied the suggested fix above in my fork: https://github.com/jonathanan/packer-windows/commit/9f1e976bcd73f5c517d64b6c002074048087867e
However, I ran into issues Access Denied issues when calling'%windir%\microsoft.net\framework\v2.0.50727\ngen.exe' as the vagrant user.
Yes, the vagrant
user is part of the Administrators
group.
@jonathanan I'm running into the same issue using my vagrant user. Did you ever resolve this?
@jryanrembert No sorry I haven't looked into this any further.
@jryanrembert @jonathanan Is this the error that you have been seeing (assuming that path to ngen.exe has been fixed)?
==> virtualbox-iso: Provisioning with shell script: ./packer-windows/scripts/compile-dotnet-assemblies.bat
virtualbox-iso:
virtualbox-iso: C:\Users\vagrant>if "AMD64" == "AMD64" goto 64BIT
virtualbox-iso:
virtualbox-iso: C:\Users\vagrant>C:\Windows\microsoft.net\framework\v4.0.30319\ngen.exe update /force /queue
virtualbox-iso: Microsoft (R) CLR Native Image Generator - Version 4.0.30319.34209
virtualbox-iso: Copyright (c) Microsoft Corporation. All rights reserved.
virtualbox-iso:
virtualbox-iso: Error while deleting native images in CLR version v2.0.50727: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
virtualbox-iso:
virtualbox-iso:
virtualbox-iso: Error while deleting native images in CLR version v4.0.30319: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
virtualbox-iso:
virtualbox-iso:
virtualbox-iso: C:\Users\vagrant>C:\Windows\microsoft.net\framework64\v4.0.30319\ngen.exe update /force /queue
virtualbox-iso: Microsoft (R) CLR Native Image Generator - Version 4.0.30319.34209
virtualbox-iso: Copyright (c) Microsoft Corporation. All rights reserved.
virtualbox-iso:
virtualbox-iso: Error while deleting native images in CLR version v2.0.50727: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
virtualbox-iso:
virtualbox-iso:
virtualbox-iso: Error while deleting native images in CLR version v4.0.30319: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
virtualbox-iso:
$
virtualbox-iso: C:\Users\vagrant>C:\Windows\microsoft.net\framework\v4.0.30319\ngen.exe executequeueditems
virtualbox-iso: Microsoft (R) CLR Native Image Generator - Version 4.0.30319.34209
virtualbox-iso: Copyright (c) Microsoft Corporation. All rights reserved.
virtualbox-iso: Uninstalling assembly Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access is denied
(Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly CustomMarshalers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access is den
ed. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access is den
ed. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access is den
ed. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access
s denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 because of an error during compilation: Access is denied. (Ex
eption from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 because of an error during compilation: Access is den
ed. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 because of an error during compilation: Access i
denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly PresentationFramework.Aero, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 because of an error during compilation: Acc
ss is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly PresentationFramework.Classic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 because of an error during compilation:
ccess is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly PresentationFramework.Luna, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 because of an error during compilation: Acc
ss is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly PresentationFramework.Royale, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 because of an error during compilation: A
cess is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 because of an error during compilation: Access is denied. (Exce
tion from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.ComponentModel.Composition, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 because of an error during compilati
n: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access is
denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: A
cess is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: A
cess is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 because of an error during compilation: Access is denied.
Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 because of an error during compilation: Access is denied.
Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 because of an error during compilation: Access is den
ed. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Acces
is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access is denie
. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Dynamic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access is denie
. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Dynamic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access is denie
. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access is de
ied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 because of an error during compilation: Access
is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 because of an error during compilation: Access
is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access i
denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 because of an error during compilation: Access is
enied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of an error during compilation: Access is
enied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
virtualbox-iso: Uninstalling assembly System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 because of an error during compilation: Access is
denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
Looks like #194 would address the path issue.
Fixed by #194
The compile-dotnet-assemblies.bat script fails on the Windows 7 trial image when Windows Updates are disabled. The script looks for ngen.exe in '%windir%\microsoft.net\framework\v4.0.30319\ngen.exe'.
Windows 7 ships with v3.5 by default and has no .NET v4. Also, there is no ngen.exe available in v3.5, but it is in 2.0.50727.
So the script should be modified to check for ngen.exe in previous versions if it can't be found in the default location. Another solution would be to add a parameter to the script that takes the .NET version folder to use and then to adjust the packer script for each Windows version.