Errors using GAC_MSIL assemblies on VSTS

1

I have an ASP web form Project stored in VSTS, and I am trying to build it. Suddenly I got this error in the build section:

2017-04-18T22:01:20.3859517Z Build FAILED.
2017-04-18T22:01:20.3859517Z 
2017-04-18T22:01:20.3869498Z "d:\a\1\s\WebTimeSheet.sln" (default target) (1) ->
2017-04-18T22:01:20.3869498Z "d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj" (default target) (2) ->
2017-04-18T22:01:20.3869498Z (ResolveComReferences target) -> 
2017-04-18T22:01:20.3869498Z   C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2399,5): warning MSB3284: Cannot get the file path for type library "2df8d04c-5bfa-101b-bde5-00aa0044de52" version 2.5. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-18T22:01:20.3869498Z   C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2399,5): warning MSB3284: Cannot get the file path for type library "00020813-0000-0000-c000-000000000046" version 1.7. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-18T22:01:20.3869498Z   C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2399,5): warning MSB3284: Cannot get the file path for type library "00020905-0000-0000-c000-000000000046" version 8.5. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-18T22:01:20.3869498Z   C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2399,5): warning MSB3284: Cannot get the file path for type library "0002e157-0000-0000-c000-000000000046" version 5.3. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-18T22:01:20.4149496Z 
2017-04-18T22:01:20.4149496Z 
2017-04-18T22:01:20.4149496Z "d:\a\1\s\WebTimeSheet.sln" (default target) (1) ->
2017-04-18T22:01:20.4149496Z "d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj"     (default target) (2) ->
2017-04-18T22:01:20.4149496Z (CoreCompile target) -> 
2017-04-18T22:01:20.4149496Z   Helpers\ExcelDataBuilder.cs(6,17): error CS0234: The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-18T22:01:20.4149496Z   Helpers\WordInvoiceBuilder.cs(5,17): error CS0234: The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-18T22:01:20.4149496Z   Helpers\ExcelDataBuilder.cs(127,104): error CS0246: The type or namespace name 'Worksheet' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-18T22:01:20.4149496Z   Helpers\ExcelDataBuilder.cs(166,80): error CS0246: The type or namespace name 'Worksheet' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-18T22:01:20.4149496Z   Helpers\ExcelDataBuilder.cs(18,17): error CS0246: The type or namespace name 'Application' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-18T22:01:20.4149496Z   Helpers\WordInvoiceBuilder.cs(172,143): error CS0246: The type or namespace name 'Document' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-18T22:01:20.4149496Z   Helpers\WordInvoiceBuilder.cs(19,17): error CS0246: The type or namespace name 'Application' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-18T22:01:20.4149496Z 
2017-04-18T22:01:20.4149496Z     4 Warning(s)
2017-04-18T22:01:20.4149496Z     7 Error(s)

I am using Hosted Queue to build the project. I have tried to get a local copy of the asemblies, include them into the project (/bin) and upload them, but it does not work. ¿How Can I include them into the build so I can avoid this error?

If I build the project in my local using Visual Studio Community 2015, works fine (the aseemblies are already included in references).

I have no private agents (just using Hosted). My build configuration was default build. Everythign else by defaul. NuGet restore, .sln root path, default visual studio build and no test assemblies.

Sorry if I forgot something else.

Many thanks,

c#
asp.net
.net
azure-pipelines
asked on Stack Overflow Apr 18, 2017 by Francisco Liñan Gomez • edited Apr 19, 2017 by Francisco Liñan Gomez

1 Answer

0

Well, after some in-depth research, I finally got it. I solved it in two steps:

First Step. I have included the dll's in the **\bin\ folder. These dll's are part of GAC embeded assembly, so the way to get them is See this article

Get DLL Out of The GAC

DLLs once deployed in GAC (normally located at c:\windows\assembly) can’t be viewed or used as a normal DLL file. They can’t be directly referenced from VS project. Developers usually keep a copy of the original DLL file and refer to it in the project at development (design) time, which uses the assembly from GAC during run-time of the project.

During execution (run-time) if the assembly is found to be signed and deployed in GAC the CLR automatically picks up the assembly from the GAC instead of the DLL referenced during design time in VS. In case the developer has deleted the original DLL or don't have it for some reason, there is a way to get the DLL file from GAC. Follow the following steps to copy DLL from GAC

  1. Run regsvr32 /u C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\shfusion.dll

    • shfusion.dll is an explorer extension DLL that gives a distinct look to the GAC folder. Unregistering this file will remove the assembly cache viewer and the GAC folder will be then visible as any normal folder in explorer.

      1. Open “%windir%\assembly\GAC_MSIL”.
      2. Browse to your DLL folder into the deep to find your DLL.
      3. Copy the DLL somewhere on your hard disk and refer it from there in your project
      4. Run "regsvr32 %windir%\Microsoft.NET\Framework\<.NET version directory> \shfusion.dll" to re-register the shfusion.dll file and regain the original distinct view of the GAC.

Alternatively you can get them through command line (CMD) directly

CMD "C:\Windows\assembly\GAC_MSIL"

After that I uploaded them into my project.

Second Step. I have modifed my build process adding Test assemblies (**\bin*.dll).

Also I modifed visual studio version from 2017 to 2015 (which actually does not change anything).

Maybe there is a better approach, I have simply found a way to fix it (apparently).

New VSTS output Log (FYI)

2017-04-19T09:29:15.1691631Z Done Building Project "d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj" (default targets).
2017-04-19T09:29:15.1701644Z Done Building Project "d:\a\1\s\WebTimeSheet.sln" (default targets).
2017-04-19T09:29:15.1721645Z 
2017-04-19T09:29:15.1721645Z Build succeeded.
2017-04-19T09:29:15.1841654Z 
2017-04-19T09:29:15.1841654Z "d:\a\1\s\WebTimeSheet.sln" (default target) (1) ->
2017-04-19T09:29:15.1841654Z "d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj" (default target) (2) ->
2017-04-19T09:29:15.1841654Z (ResolveComReferences target) -> 
2017-04-19T09:29:15.1841654Z   C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2399,5): warning MSB3284: Cannot get the file path for type library "2df8d04c-5bfa-101b-bde5-00aa0044de52" version 2.5. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-19T09:29:15.1841654Z   C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2399,5): warning MSB3284: Cannot get the file path for type library "0002e157-0000-0000-c000-000000000046" version 5.3. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) [d:\a\1\s\WebTimeSheet\WebTimeSheet.csproj]
2017-04-19T09:29:15.1841654Z 
2017-04-19T09:29:15.1841654Z     2 Warning(s)
2017-04-19T09:29:15.1841654Z     0 Error(s)
2017-04-19T09:29:15.1841654Z 
2017-04-19T09:29:15.1851621Z Time Elapsed 00:00:10.59
2017-04-19T09:29:15.2201873Z ##[section]Finishing: Build solution
answered on Stack Overflow Apr 19, 2017 by Francisco Liñan Gomez • edited Apr 19, 2017 by Francisco Liñan Gomez

User contributions licensed under CC BY-SA 3.0