From where do I reference a missing assembly (System.Net.Http.Formatting)? - .net-assembly

In my Visual Studio 2013 RC project, I'm getting this err msg:
"The type 'System.Net.Http.Formatting.MediaTypeFormatter' is defined
in an assembly that is not referenced. You must add a reference to
assembly 'System.Net.Http.Formatting, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35'"
...on the "var response = " line of code in a Controller:
public HttpResponseMessage PostDelivery(Delivery delivery)
{
delivery = repository.Add(delivery);
var response = Request.CreateResponse<Delivery>(HttpStatusCode.Created, delivery);
string uri = Url.Link("DefaultApi", new { id = delivery.Id });
response.Headers.Location = new Uri(uri);
return response;
}
Searching my hard drive for the required assembly ("System.Net.Http.Formatting"), it shows me several locations where it exists, but they are all within existing projects, as is seen here:
Surely there is another location from which System.Net.Http.Formatting.dll can be referenced! But where?
UPDATE
Trying to follow the clue here: http://www.nuget.org/packages/System.Net.Http.Formatting
IOW, by selecting Tools > Library Package Manager > Package Manager Console, and entering:
Install-Package System.Net.Http.Formatting -Version 4.0.20710
...I see the red bulls of Pamplona (not the beverage) descending wild-eyed upon me:
UPDATE 2
I added the System.Net.Http.Formatting.dll from here:
C:\Users\clay\My Documents\Visual Studio 2013\Projects\MvcApplication1\MvcApplication1\bin
...and it now compiles and runs and works as expected, but that is obviously "not the preferred method"

I had the same problem. I used Microsoft Asp Net WebApi Client 4.0.20710 and it worked for me.
Type the following command into Tools > Library Package Manager > Package Manager Console:
Install-Package Microsoft.AspNet.WebApi.Client -Version 4.0.20710

Adding to what Luiz answered above.
System.Net.Http.Formatting is a library and is used for media type formatting. For example:
http://msdn.microsoft.com/en-us/library/system.net.http.formatting.jsonmediatypeformatter(v=vs.118).aspx
When referencing it, when I tried, I was looking to add a reference in my project and was looking in the Assemblies/Framework folder in Reference Manager.
It is actually in the Assemblies/Extensions folder in Reference Manager

If you got an error trying to install System.Net.Http.Formatting -Version 4.0.20710, try this one:
Install-Package WebApiDoodle.Net.Http.Formatting -Pre
I just found on NuGet: https://www.nuget.org/packages/WebApiDoodle.Net.Http.Formatting/3.0.0-pre01

Right click on project and click Add a reference option, then go to Extensions from
Assemblies tab and choose System.Net.Http.Formatting.
If it is no in here you have to manually add in prgramme files-> Microsoft ASP.NET

One other simple option for resolving this is to right click on references, click 'Manage NuGet References', Browse for 'Microsoft.AspNet.WebApi.Client' and install it or perhaps reinstall it. Review the package information to learn more.

I ran into the same problem on vs2022 v16.11.5.
I was fortunate enough to have the project working on one machine but not another. On the suspect machine, under project References, System.Net.Http.Formatting could not be found. Running the visual studio installer app and modifying the vs2022 install to include the ASP.NET and web development package fixed me up.
ASP.NET and Web development Install image

Related

Error while creating package for uwp

I'm developing an app with C# & Visual Studio 2015 Community for windows 10.
I was trying to create a package for store (appxupload file) but it gives me error:
Loading assembly "C:\Users\Ramtin\.nuget\packages\System.Private.Uri\4.0.0\runtimes\win8-aot\lib\netcore50\System.Private.Uri.dll" failed. System.IO.FileNotFoundException: Could not load file or assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Invalid Resx file. String reference not set to an instance of a String.
Parameter name: suffix MyAPP C:\Users\Ramtin\.nuget\packages\System.Private.Uri\4.0.0\runtimes\win8-aot\lib\netcore50\System.Private.Uri.dll
how can I solve this?
note: I have individual account for develop
I haven't received this error myself, but you should verify that you have the latest Windows 10 SDK installed and latest VS2015 updates.
Visual Studio 2015 Update 2 just came out last week: https://www.visualstudio.com/en-us/news/vs2015-update2-vs.aspx
When you launch VS2015, check the notifications area on the top right for any newly available updates.
When you click File | New | Project in VS2015, check the list of Universal project template types and look to see if there's a list item that prompts you to download the latest SDK.
My screenshot below shows the template types and also the (optional) Template10 that I have available to me. If you don't have the latest SDK, you should see an additional entry that prompts you to download the latest SDK (as opposed to creating a new project)
After verifying that you have the latest of everything, try generating a new package again and please comment below to let us know whether it worked (or if you are still getting errors).

How to properly create an Alea GPU project? Errors on "Getting Started" code

I have done the following to create an Alea GPU project in Visual Studio 2012 Professional:
File > New > Project > F# Application
Updated NuGet Package Manager to latest version
Tools > NuGet Package Manager > Console
PM> Install-Package Alea.CUDA
PM> Install-Package Alea.CUDA.IL
Installed license using these instructions: http://quantalea.com/static/app/tutorial%5Cgetting_started%5Cinstall_license.html
Copied the code from here https://github.com/quantalea/AleaGPUTutorial/blob/master/src/fsharp/getting_started/ParallelSquare.fs into my main project file.
Build Solution.
I get the following errors:
The lines numbers and file from the GitHub link above correspond with each other.
I'm new to using Alea GPU, Visual Studio, and F#. I've tried doing what I could with the resources I have available. Although the the Alea GPU website explains what to do (install Alea through NuGet, install license, provides code, etc.) it might be targeted to users who have experience working with Visual Studio. It's also worth mentioning I have CUDA drivers installed on this machine.
I have also followed the instructions on this page, but it seems like it's still under construction: http://quantalea.com/static/app/tutorial%5Cgetting_started%5Ccreate_new_project.html. I'm not using Fody since I won't be using C#.
Thanks for reporting the web site problem. Yes, our document are under constructing. I tried your steps and I figured out how to do it correctly, which I will show you later. The issues you met are mainly because:
You are using VS2012, which by default referencing FSharp 3.0, which is a little out-of-date, we suggest to use FSharp 3.1
You forget to reference other assemblies which is used in the code, such as NUnit and FSharp.Charting
Alea.CUDA.Fody doesn't means to work with C#, it means to do AOT compile on GPU code. It uses Fody plugin to compile GPU code during MSBuild process, so your appliction doesn't need to compile GPU code in runtime.
Now, here are the steps:
Open VS 2012, upgrade nuget plugin, then new F# console application project
Expand "References" in solution explorer, and remove the FSharp.Core reference (since it is FSharp 3.0, we will replace it with new 3.1)
Go to "Package Manager Console", install some nuget packages which is used in the code:
Install-Package FSharp.Core
Install-Package FSharp.Charting
Install-Package NUnit
Now we will install Alea.CUDA.Fody (which will install Alea.CUDA by dependency). But since Fody plugin has to run some powershell script to create an FodyWeavers.xml file to configure Fody usage, and this script doesn't work well with F# project (it works with C# project). The workaround is simple, just click "save all" in VS2012 before you run Install-Package Alea.CUDA.Fody. You will see some red error in the package manager console, that is fine, it is just the Fody plugin's script doesn't work well with F# project. You can safely ignore it. After install Alea.CUDA.Fody, a file FodyWeavers.xml file will be added to your project, there you can configure how you will do the AOT compilation. I suggest you add a setting to show verbose information: <Alea.CUDA Verbose="true"/>
Now you need add some common references, since the package FSharp.Charting uses them. To do that, right click your "References" in solution explorer, and choose "Add Reference...", under "Assemblies" -> "Framework", select these assemblies:
System.Drawing
System.Windows.Forms
System.Windows.Forms.DataVisualization
Now your project is set. Please Change the building configuration to "Release".
Now let's add the source file. First right click Program.fs in solution explorer, and select "Add above" -> "New Item...", select F# source file, name it ParallelSquare.fs
Copy https://github.com/quantalea/AleaGPUTutorial/blob/master/src/fsharp/getting_started/ParallelSquare.fs into that new created file
You need modify one place: https://github.com/quantalea/AleaGPUTutorial/blob/master/src/fsharp/getting_started/ParallelSquare.fs#L139 , change this to WorkerExtension.Launch(worker, <# squareKernel #>) lp dOutputs.Ptr dInputs.Ptr inputs.Length , the reason is, the Launch method is an extension method, which the FSharp compiler in VS 2012 doesn't support it well, so we call that extension method directly (So I suggest you to use VS 2013).
Now in your Program.fs file, call the test in main function: Tutorial.Fs.quickStart.ParallelSquare.squareChart(). and then you can press "F5" to run it.
After this, I suggest you read http://quantalea.com/static/app/manual/compilation-index.html where explains the intallation, the AOT vs JIT compilation, etc.

Project is targeting frameworks not installed or are included as part of future updates to Visual Studio

I am attempting to convert the Microsoft.Health C# class library that is installed as part of the HealthVault SDK, using instructions provided here. After following these instructions, I get the following error when attempting to load the project into Visual Studio 2013.
"The project is targeting frameworks hat are either not installed or
are included as part of future updates to Visual Studio. See
http://go.microsoft.com/fwlink/?LinkId=287985"
Visiting the link takes me to .NET SDKs and Downloads. Once there, I have no clue on what needs to be done.
I do realize that one will have to leverage the Portable Class Library Contrib project to fill in some missing bits, especially code related to System.Security. This, I will deal with later.
Any one run into a similar problem?
Maybe so late but for those who have the same problem.
I had the same error in a project which was working perfect before updating VS2013 and finally after 3 hours looking for the source of the error I found that the error is about TargetFrameworkProfile.
In my case I sloved it like so:
Right click in the unloaded project in your solution and click Edit.
Find the TargetFrameworkProfile tag and set it as below:
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
At a guess, this is because you need to specify the TargetFrameworkVersion and TargetFrameworkProfile properties in the project file. Compare the .csproj you are trying to create to a newly created PCL project file, and make sure that everything that's not specific to your project matches.
I ran into the same issue and got it resolved by installing the latest Visual Studio Update

The "SlowCheetah.Xdt.TransformXml" task could not be loaded from the assembly

After installing Slow Cheeath (v. 2.5.10.3) to two projects in my solution, I am receiving the following error:
"The "SlowCheetah.Xdt.TransformXml" task could not be loaded from the assembly C:\Users
\User\AppData\Local\Microsoft\MSBuild\SlowCheetah\v2.5.10.2\SlowCheetah.Xdt.dll. Could
not load file or assembly 'file:///C:\Users\User\AppData\Local\Microsoft\MSBuild
\SlowCheetah\v2.5.10.2\SlowCheetah.Xdt.dll' or one of its dependencies. The system cannot
find the file specified. Confirm that the <UsingTask> declaration is correct, that the
assembly and all its dependencies are available, and that the task contains a public
class that implements Microsoft.Build.Framework.ITask. ISA.IMPD.FalseAlarm.Web.Portal"
I have removed both projects in their entirety (along with Slow Cheetah), re-installed both projects (along with Slow Cheetah), and Rebuilt the solution to no avail. Can anyone help with this type of error?
In my case the error occured while compiling a web project. The folder
%userprofile%\AppData\Local\Microsoft\MSBuild\SlowCheetah\v2.5.10.2
was empty. All the SlowCheetah components were in SlowCheetah\v1 folder instead. I've copied all files from V1 folder to v2.5.10.2 and everything compiled and transformed fine. To make non web projects compile, I also had to delete V1 folder as suggested by Whoever in this thread.
This was a brand new installation of the SlowCheetah Extension and I did not expect the v1 folder to exist at all. I believe this was a bug in the extension installation for Visual Studio 2012.
delete
AppData\Local\Microsoft\MSBuild\SlowCheetah\v1
I seem to have found to solution to this problem.
Here's what I did:
You need to close Visual Studio, then navigate to:
C:\Users\username\AppData\Local\Microsoft\VisualStudio\11.0\Extensions
Delete the cache file that has the latest date and time
Open Visual Studio and remove Slow Cheetah from the Solution level
Re-install Slow Cheetah from the solution level to the desired projects.
This was failing on our build server, so I changed the revision number from:
<sc-MSBuildLibPathLocal Condition=" '$(sc-MSBuildLibPathLocal)'=='' ">$(LocalAppData)\Microsoft\MSBuild\SlowCheetah\v2.5.10.2\</sc-MSBuildLibPathLocal>
To:
<sc-MSBuildLibPathLocal Condition=" '$(sc-MSBuildLibPathLocal)'=='' ">$(LocalAppData)\Microsoft\MSBuild\SlowCheetah\v2.5.10.3\</sc-MSBuildLibPathLocal>
Why it was pointed to v2.5.10.2 is a mystery, but I'm definitely using v2.5.10.3! Looks like the nuget package itself has the bug in it.
I resolved it like this:
Uninstall slowcheetah => Tools>Extensions and Updates
click OK when VS asks you to restart VS.
in "C:\Users\AppData\Local\Microsoft\MSBuild\SlowCheetah" remove the 'v1' folder (which windows automatically creates when restarting your VS) (here be dragons..)
reïnstall slowcheetah (see step 1) => a new folder v2.5.10.2 will be created.
Again, click OK when he asks to restart
Build your solution
Regards,
Peter
This problem went away for me after using the preview transformation feature in the context menu. Originally suggested here.
FYI this was on VS 2010 Premium.
Having multiple versions can lead to conflicts.
In my case I have installed both Microsoft.VisualStudio.SlowCheetah by Microsoft and SlowCheetah by Sayed Ibrahim Hashimi. After uninstalling the package from Microsoft everything went well.
I have deleted the old files in C:\Users\\AppData\Local\Microsoft\MSBuild\SlowCheetah\v1. I also needed to upgrade Visual Studio 2012 to update 4 to make it work.
I was able to fix this issue by doing the following:
Uninstalling the SlowCheetah extension from the TOOLS > Extensions and Updates... menu
Closing Visual Studio
Deleting all files in the "C:\Users\username\AppData\Local\Microsoft\VisualStudio\11.0\Extensions" folder
Opening Visual Studio
Reinstalling SlowCheetah from the TOOLS > Extensions and Updates... menu (which requires a Visual Studio restart)
This is using Visual Studio 2012 Premium with Update 4 and SlowCheetah version 2.5.10.
If you're getting this error on a TFS Build Server (in my case TFS Express 2013) then you will need to copy over the files from your local machine
C:\Users\SWEAVER\AppData\local\Microsoft\MSBuild\SlowCheetah
on your machine to whichever user your TFS build is running under
C:\users\TFSBuild\AppData\Local\Microsoft\MSBuild\SlowCheetah
Please note AppData is a hidden directory that you may not see, but just type the name and hit enter and it will come up.
I'm using VS2013 so I didn't copy v1 (I think v1 is for VS2012).
The original TFS error I got was :
C:\Builds\1\www.XXXXX.com\RRStore - XXXXX
Silverlight\Sources\RRStore.AdminConsole\Properties\SlowCheetah\SlowCheetah.Transforms.targets
(150): The "SlowCheetah.Xdt.TransformXml" task could not be loaded
from the assembly
C:\Users\TFSBuild\AppData\Local\Microsoft\MSBuild\SlowCheetah\v2.5.10.2\SlowCheetah.Xdt.dll.
Could not load file or assembly
'file:///C:\Users\TFSBuild\AppData\Local\Microsoft\MSBuild\SlowCheetah\v2.5.10.2\SlowCheetah.Xdt.dll'
or one of its dependencies. The system cannot find the file specified.
Confirm that the declaration is correct, that the assembly
and all its dependencies are available, and that the task contains a
public class that implements Microsoft.Build.Framework.ITask.
Fortunately this error told me exactly where to place the files.
I had the same problem in Visual Studio 2013. Just install SlowCheetah NuGet package:
https://www.nuget.org/packages/SlowCheetah
They've released a new version which brings the installation procedure up to date:
https://blogs.msdn.microsoft.com/visualstudio/2017/05/25/whats-new-and-improved-with-the-slowcheetah-extension/
Tired of having to install your NuGet packages manually to get
SlowCheetah to work? We’ve added automatic NuGet installation to help
streamline your process. All you need to install is the latest
extension and SlowCheetah will take care of the rest. When you use
SlowCheetah for the first time in a project, it will prompt you to
install or update NuGet packages. Agree and you’re ready to go!
Close Visual Studio
Install the VISX extension
Open your project.
This version detects if you already have it installed and offers to upgrade.
I would recommend checking in to source control and then doing a compare of your .csproj file to see what changes it made.

VS 2012 project references all missing-- troubleshooting techniques?

I've downloaded a straightforward VS 2012 solution and for some reason am having trouble with the references in it-- they're all marked with yellow exclamation points, even core .Net libraries.
This isn't a problem in any of my other VS 2012 projects. I've scrubbed and redownloaded the solution several times, each with the same result.
I'm using VS 2012 Professional, update 3, and I have the .Net 4.5 runtime installed. So I think I'm caught up on the latest platform and tools.
I updated all the NuGet packages in the solution but that didn't help. Would anyone know what I can look at to see where the problem is? (I downloaded this same solution on another box and have no problems whatsoever. Both machines are running Windows 7.)
Popped open the Solution and got the following errors:
Warning 2 The command ""C:\****************\Downloads\PluralsightSpaJumpStartFinal-master\PluralsightSpaJumpStartFinal-master\.nuget\nuget.exe" install "C:\*************\PluralsightSpaJumpStartFinal-master\PluralsightSpaJumpStartFinal-master\SPAJumpStart\packages.config" -source "" -RequireConsent -o "C:***************\PluralsightSpaJumpStartFinal-master\PluralsightSpaJumpStartFinal-master\packages"" exited with code 1. SPAJumpStart
Warning 1 Package restore is disabled by default. To give consent, open the Visual Studio Options dialog, click on Package Manager node and check 'Allow NuGet to download missing packages during build.' You can also give consent by setting the environment variable 'EnableNuGetPackageRestore' to 'true'. SPAJumpStart
Looks like the references are tied into a custom nuget package, including the normal .net 4.5 references. Enabling the 'EnableNuGetPackageRestore' option should fix the issue.

Resources