web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Error when loading assembly: Could not load type 'System.Net.Http.HttpContent' from assembly

(1) ShareShare
ReportReport
Posted on by 31
I'm trying to access SharePoint using a simple HttpClient from using System.Net.Http; 
The project builds but the assembly doesn't load on on Plugin Registration Tool. And I see this error:
Unhandled Exception: System.TypeLoadException: Could not load type 'System.Net.Http.HttpContent' from assembly 'CrmVSSolution.Workflows, Version=1.3.0.0, Culture=neutral, PublicKeyToken=dc437796e33d376f' because the method 'get_Headers' has no implementation (no RVA).
   at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
   at System.Reflection.RuntimeAssembly.GetExportedTypes()
   at Microsoft.Crm.Tools.Libraries.CrmAssemblyReader.RetrievePluginsFromAssembly(String path)
   at Microsoft.Crm.Tools.Libraries.CrmAssemblyReader.RetrievePluginsFromAssembly(String path)
   at Microsoft.Crm.Tools.Libraries.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly, String appPath)
   at Microsoft.Crm.Tools.AssemblyRegistration.PluginRegistrationViewModel.BtnLoadAssemblyClicked()
My project file includes these lines.
    <Reference Include="System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Net.Http.dll</HintPath>
    </Reference>
I have the same question (0)
  • Verified answer
    Sachin Jadhav Profile Picture
    157 on at
    Are you adding the direct reference to the assembly "System.Net.Http"?
     
    May be you can give this a try
     
    1. From your project references list remove the reference to "System.net.Http" by right clicking and using Remove option
     
    2. Install the nuget package named "system.net.http"
     
    Here is the package you are installing: https://www.nuget.org/Packages/system.net.http
     
    3. Build your project and then try to register
     
  • Verified answer
    Marcos Profile Picture
    31 on at
    Thanks, Sachin, this kind of works. After many tries I found out that I need to set the Nuget package version to 4.0. 
    Probably not the most advised solution, since the package is tagged as vulnerable, but it works.

    If anyone has another suggestion, I'd happily hear it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 70

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans