سؤال

I have a project that uses the Pkcs12ProtectedConfigurationProvider. There were never any problems using this dll in azure when targeting windows server 2008 sp2 or r2. However, when I tried to deploy to azure using windows server 2012 (osFamily="3"), I got an exception stating that the assembly could not be found.

I vaguely recall running into this in the emulator, and the solution was to add this dll to the GAC. I googled and found these instructions regarding how to install a DLL into the GAC as an azure startup task. Everything works as long as I have the gacutil and the related .cmd file in the root of the web role project. However, I want to move this into the app's /startup folder where I have other startup commands.

So far I have been unable to get this to work. gacutil isn't very helpful either as I have not been able to get it to show any output after I run commands against it. Here is what I have tried:

in the csdef file:

<Startup>
  <!-- other tasks, such as disabling the IIS idle timeout -->
  <Task commandLine="startup\gacRegistrations.cmd" executionContext="elevated" taskType="simple" />
</Startup>

in the gacRegistrations.cmd file:

gacutil /nologo /i ..\PKCS12ProtectedConfigurationProvider.dll
exit /b 0

I think the problem has to do with the syntax referencing the dll's location in the cmd file. All of the relevant files are set to build action: none and copy to output directory:copy always. However, the gacutil.exe and cmd file get copied to webrole/bin/startup, whereas the PKCS12ProtectedConfigurationProvider.dll file is 1 folder up, in webrole/bin.

What is the correct syntax here? Should I try gacutil /nologo /i ..\.\PKCS12ProtectedConfigurationProvider.dll? Like I said, everything works fine when the files are not nested in a /startup directory.

هل كانت مفيدة؟

المحلول

The current directory is always the bin folder, so you should try the following:

startup\gacutil /nologo /i PKCS12ProtectedConfigurationProvider.dll
exit /b 0
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top