I'm developing a webpart in Sharepoint 2013 using VS2012. In this webpart I'm using a custom dll that I created. The library framework is 4.0 and the visual webpart framework is 4.5.
The problem is when I'm adding the webpart in sharepoint page, the following error appeared:
Could not load file or assembly 'RulesDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d2371e81bc184aa5' or one of its dependencies. The system cannot find the file specified
Searching in google I found a lot of solutions to resolve this problem
Adding library to GAC using two methods.
(1) gacutil -i RulesDll.dll
(2) Using package ---> Advanced options in the solution explorer in VS2012
When I running gacutil -l RulesDll in VS command prompt everything sames to work:
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.17929
Copyright (c) Microsoft Corporation. All rights reserved.
The Global Assembly Cache contains the following assemblies:
RulesDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d2371e81bc184aa5, processorArchitecture=x86
Number of items = 1
So the library is in the GAC.
Adding the library to the save control in web.config
But nothing works. Does someone know why it's impossible to add my own webpart in a sharepoint page?
What's the error you get once your assembly is in GAC and you try to add the webpart on the page?
Check the web.config of your application and especially the SafeControls section, there should be a reference to your assembly.
http://technet.microsoft.com/en-us/library/cc261736.aspx
Finally found the error. All libraries must be deploy in x64
Related
I have a C# project that I'd like to use as a .NET Standard 2.0 library for other .NET assemblies and as a COM component for native code. I could create the COM object just fine when I targeted the full .NET Framework, but when I created a new project targeting .NET Standard, I got this error when I tried register it:
regasm /codebase /tlb MyLib.dll
RegAsm : error RA0000 : Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
How can I build and register a DLL that is compatible with both .NET Standard and COM?
Ensure that .NET 4.7.1 is installed. Even then, since Visual Studio doesn't copy NuGet packages to the output directory, expect to get a similar "Could not load file or assembly" error for one of those.
If you can live with a single project but two DLLs, this is an alternative: In your .csproj, remove the TargetFramework line and replace it with multiple targets, according to what your code needs, for example:
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
Then use the net461 DLL for use by COM and the netstandard2.0 for use by .NET.
I am not 100% sure if this is a NuGet issue or a configuration issue elsewhere. I am trying to modify some code in a project that references EPPlus 3.x.x, all the projects in the entire solution do actually however in one of the projects (the one containing our entities) a colleague upgraded it to use 4.0.0.1 (which is the beta version). Here are the actual lines from the csproj files.
//from the project where our entities our housed
C:\work\Dev\SourceCode\Compass.Data\packages.config(7): <package id="EPPlus" version="4.0.0-beta2" targetFramework="net40" />
//from the project I am trying to debug (step through).
C:\work\Dev\SourceCode\Compass.Business\packages.config(7): <package id="EPPlus" version="3.1.3.3" targetFramework="net45" />
what is happening is that I keep getting the following error.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'EPPlus, Version=4.0.0.1, Culture=neutral, PublicKeyToken=ea159fdaa78159a1' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
looking in the packages folder I am seeing the following.
C:\work\Packages\EPPlus.4.0.0-beta2\lib\net20
I think the issue is that there is a net20 folder and the configuration says targetFramework="net40" but I not even sure of that. If that is the problem I don't know how to fix it either.
Hopefully someone can explain what is going on.
Thank you.
So - while I don't really have an answer as to why I do have an answer to this problem that may help someone trying to debug in the future.
after some testing I realized that this worked perfectly fine when you didn't have a debugger attached. The only time I had a problem was when I wanted to step through the code. To solve this I installed the version is was looking for into the GAC. I am not 100% sure why this worked but it did solve the problem for me.
C:\WINDOWS\system32>cd C:\work\Packages\EPPlus.4.0.0-beta2\lib\net20
C:\work\Packages\EPPlus.4.0.0-beta2\lib\net20>gacutil /i EPPlus.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.33440
Copyright (c) Microsoft Corporation. All rights reserved.
Assembly successfully added to the cache
C:\work\Packages\EPPlus.4.0.0-beta2\lib\net20>gacutil /l epplus
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.33440
Copyright (c) Microsoft Corporation. All rights reserved.
The Global Assembly Cache contains the following assemblies:
epplus, Version=4.0.0.1, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL
Number of items = 1
C:\work\Packages\EPPlus.4.0.0-beta2\lib\net20>
In my case it happened on a ASP.NET website.
I did update the EPPLus.dll reference, but the publish function has not replaced the old file with the new one.
Removed the dll manually and publishing again
I've uploaded an MVC3 website and I'm getting this error:
Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified.
Having seen this before I know that it's an issue where the libraries I need aren't there. I have to bin deploy.
However I can't find the "Add Deployable Assemblies" option when I right click the project.
And according to this answer:
Starting with MVC 3 Tools Update we are now using Nuget package
references, which means that your project is automatically
bin-deployable. Since the tooling gesture is no longer necessary it
was removed from VS 11.
So why hasn't my application been "automatically bin-deployed" if this is the case?
Any suggestions?
Install Visual Studio 2010 Service Pack1 and you will get the option.
http://iwantmymvc.com/2011-03-23-bin-deploy-aspnet-mvc-3-visual-studio
Is this possible? Right now the Power Tools 2008 check-in policies from Visual Studio 2008 are causing errors with Visual Studio 2010. In my own work with custom check-in policies it has required referencing different versions of some of the TFS libraries - 9.0.0.0 vs 10.0.0.0 typically. I'm not really bullish on their being a good solution here, but if anyone knows of one please do share.
Internal error in Changeset Comments Policy. Error loading the
Changeset Comments Policy policy (The policy assembly
'Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ChangesetComments,
Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is
not registered.). Installation instructions: To install this policy,
follow the instructions in CheckForComments.cs.
Internal error in Custom Path Policy. Error loading the Custom Path
Policy policy (The policy assembly
'Microsoft.TeamFoundation.PowerTools.CheckinPolicies.CustomPathPolicy,
Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is
not registered.). Installation instructions: Please contact your
administrator
Internal error in Custom Path Policy. Error loading the Custom Path
Policy policy (The policy assembly
'Microsoft.TeamFoundation.PowerTools.CheckinPolicies.CustomPathPolicy,
Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is
not registered.). Installation instructions: Please contact your
administrator
I have fixed this problem (though mine was with a custom checkin policy) by having both versions of my custom policy dll installed and then making sure that the 2010 registry entries pointed to the 2010 dll and the 2008 registry entry pointed to the 2008 dll.
Information on where the registry entries are can be found here:
https://msdn.microsoft.com/en-us/library/bb668980.aspx but should be in the path HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\xx\TeamFoundation\SourceControl\Checkin Policies
For this to work, both dlls must have the same signatures so it may not be possible with power tools dlls but it works fine with custom policies.
Have you tried installing the Team Foundation Server 2010 Power Tools?
I try make simple Windows mobile client for web service. The web method only add two integer. I add reference on proxy and System.Web.Service.
But it finish with this error :
The type 'System.Web.Services.Protocols.SoapHttpClientProtocol' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
But I add reference on System.Web.Service
I check, and in reference is add :
Assembly System.Web.Services
E:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Web.Services.dll
I use Visual Studio 2008, where is a problem ? I try first google, but I didn't find answer. Thank
Looks like you've added a reference to the 3.5 version of system.web.services.dll, but it's asking for version 2.0. Try referencing the file at:
E:\Program Files\Microsoft.NET\SDK\CompactFramework\ v2.0 \WindowsCE\System.Web.Services.dll