Release Build Fails

Apr 12, 2013 at 3:38 PM
Edited Apr 12, 2013 at 3:39 PM
Everything is working fine when the configuration is set to debug. However, when I set the configuration to release the build fails. I get the following error.

SGEN : error : Could not load file or assembly 'file://\TeamFoundationServer\c$\Bin\MyDll.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

I thought maybe my dll needs to be built in release mode. So I changed that but that had no effect.

I then did a bunch as research and found 3 possible causes.
  • It requires full trust.
So I added '<trustLevel name="full" policyFile="internal" />' to my web.config file. This had no effect.

Maybe something in the version of IIS integrated into Visual Studio needs configured but I can't find any info on this approach.
  • The library is 32 bit and requires the program to be 32 bit.
I tried changing the project target for both the web app and the dll from 'Any CPU' to x86. This had no effect.

My OS is 64 bit maybe other settings need changed.
  • Don't use unsafe code.
The library has code that requires full trust and the new version has this in a separate assembly. I'm not sure if the unsafe code is in AntiXssLibrary.dll or HtmlSanitizationLibrary.dll but the Encode function I'm trying to use is in AntiXssLibrary.dll. So I don't know if I can exclude it by not including a dll.

Also, I briefly tried the approach of downloading the source code and removing the code but I got errors the project files couldn't be loaded when I tried opening the project.

Can someone help me get this to work?