I have installed Install-Package Microsoft.AspNet.Web.Optimization -Version 1.0.0 in my VS2010. and i checked in Manage NuGetPackages in that "Microsoft ASP.NET Web Optimization Framework" is showing as installed. But still getting error as
"The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)"
Is there any solution for this.how can i fix this.
In Visual Studio:
Go to Tools -> Library Package Manager -> Package Manager Console
Then:
PM> Install-Package Microsoft.AspNet.Web.Optimization -Pre
when i install this its working fine.
Related
I'm getting the error of the tittle when trying to use XCT TabView.
I'm using Microsoft Visual Studio Community 2022. I installed XCT in my project by running both the commands in NuGet Package Manager Console:
Install-Package Xamarin.CommunityToolkit
Install-Package Xamarin.CommunityToolkit.Markup
In NuGet solution manager I selected both packages, I checked every checkbook responding to my projects and I hit "Install".
I get the following errors and warnings though:
Package restore failed. Rolling back package changes for 'MyProject'.
and
Error NU1605 Detected package downgrade: Xamarin.Forms from 5.0.0.2291 to 5.0.0.2196. Reference the package directly from the project to select a different version.
MyProject -> Xamarin.CommunityToolkit.Markup 2.0.0 -> Xamarin.Forms (>= 5.0.0.2291)
MyProject -> Xamarin.Forms (>= 5.0.0.2196)
I also added the relative namespace to XAML: xmlns:xct="http://xamarin.com/schemas/2020/toolkit
By the way, I get the same error too for xct:TabViewItem but I additionally get another error for it: Cannot resolve type "xct:TabViewItem"
Any ideas?
I had tried to do this and met the same problem as you.
This issue happened because the version of xamarin.forms is too low. So you can open the nuget package manager to update the xamarin.forms to the lastest version.
You can also download the earlier version of the Xamarin.CommunityToolkit and Xamarin.CommunityToolkit.Markup such as 1.3.1
Microsoft Visual Studio Professional 2019
Version 16.0.0
VisualStudio.16.Release/16.0.0+28729.10
I added a .NET Core 2.2 MSTest project and it added dependencies :
Microsoft.NET.Test.Sdk v16.0.1 ( I updated to v16.2.0 )
Microsoft.NET.Test.Sdk v1.3.2 ( I updated to v1.4.0 )
MSTest.TestFramework v1.3.2 ( I updated to v1.4.0 )
I compile and get this error :
CS0234 The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) ...\packages\microsoft.net.test.sdk\16.2.0\build\netcoreapp1.0\Microsoft.NET.Test.Sdk.Program.cs
Microsoft.NET.Test.Sdk.Program.cs
// <auto-generated> This file has been auto generated. </auto-generated>
using System;
[Microsoft.VisualStudio.TestPlatform.TestSDKAutoGeneratedCode]
class AutoGeneratedProgram {static void Main(string[] args){}}
Couple of observations :
Project is .NET Core 2.2 but it's using package from
netcoreapp1.0 folder
NuGet package manager successfully added package Microsoft.NET.Test.Sdk v16.0.1 but on build it has an unresolved
reference
The type or namespace name 'VisualStudio' does not exist in the
namespace 'Microsoft' (are you missing an assembly reference?)
...\packages\microsoft.net.test.sdk\16.2.0\build\netcoreapp1.0\Microsoft.NET.Test.Sdk.Program.cs
If we consume the Microsoft.NET.Test.Sdk package, when we compile and build our project, the Microsoft.NET.Test.Sdk.Program.cs will also be compiled by the csc.exe during the build.
So the error message indicates the Microsoft.VisualStudio.TestPlatform.TestSDKAutoGeneratedCode attribute can't be recognized well because something is wrong with the reference to Microsoft.TestPlatform.ObjectModel.dll.
Note:
1.Microsoft.VisualStudio.TestPlatform.TestSDKAutoGeneratedCode comes from assembly Microsoft.TestPlatform.ObjectModel.dll.
2.Microsoft.NET.Test.Sdk package depends on Microsoft.TestPlatform.TestHost package, and Microsoft.TestPlatform.TestHost package depends on Microsoft.TestPlatform.ObjectModel package.
If those packages are installed successfully, the compile and build should work. So actually I think something is wrong in your installed packages.
Some simple suggestions you can try:
1.Go Tools=>Nuget Package Manager=>Package Manager settings to make sure two options of Package Restore are enabled. And then delete the bin, obj folders and run a rebuild.
2.If #1 not works, try clean the nuget cache by UI in VS IDE, and then again delete the bin, obj folders, then run a rebuild.
3.Please update your VS IDE to latest version, 16.0.0 is too old, and latest version has fixed some issues.
Project is .NET Core 2.2 but it's using package from netcoreapp1.0
folder
If you open the package in path ...\packages\microsoft.net.test.sdk\16.2.0\build you can find this package only have three version of assemblies, net40, netcoreapp1.0 and uap10.0. Since your project is .net core 2.2, it will reference the assembly in netcoreapp1.0 folder. It's expected behavior.
I am using a mac with visual studio 2017. I'm trying to start up a project with NuGet packages inside. When I right click on the source and go to update NuGet packages, I receive incompatible errors for 15 of the packages.
Checking compatibility for System.Net.WebSockets 4.0.0 with
.NETCoreApp,Version=v1.1. Incompatible packages: 15 Package restore
failed. Rolling back package changes for 'project.api'.
When I restore packages for the solution, it works successfully. When I go to build the project I get 28 errors. All with the same text -
error CS0234: The type or namespace name '' does not exist in the
namespace 'project.api' (are you missing an assembly reference?)
This issue does not persist on a counterparts Windows machine. I have no idea what to do or where to go.
Side note - unsure where to go to the NuGet package manager then go to package manager settings. This exists on windows but not Mac it seems.
The latest version was not pushed to the repo. This was why I was getting the errors. So the build error is fixed but the update NuGet packages are still incompatible. Not going to worry about that for now.
I am trying to follow the official xamarin tutorial to make use of WCF Services from a Xamarin Form PCL project (URL /guides/cross-platform/application_fundamentals/web_services/walkthrough_working_with_WCF/ on Xamarin website)
However, at the time of referencing the System.ServiceModel nuget package, I get the following error and the package does NOT get installed:
Could not install package 'System.ServiceModel 1.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
I also tried profile 78 without luck (I removed Windows Phone 8.1 as explained here since there is no WCF support).
I tried different profiles for the PCL project as explained here, but without success.
Also, I tried using the Package Management Console and got similar error:
PM> Install-Package -Verbose
cmdlet Install-Package at command pipeline position 1
Supply values for the following parameters:
Id: System.ServiceModel
GET ... OK
Attempting to gather dependency information for package 'System.ServiceModel.1.0.0' with respect to project 'Mobile\MobileCashRegister', targeting '.NETPortable,Version=v4.5,Profile=Profile7'
Attempting to resolve dependencies for package 'System.ServiceModel.1.0.0' with DependencyBehavior 'Lowest'
Resolving actions to install package 'System.ServiceModel.1.0.0'
Resolved actions to install package 'System.ServiceModel.1.0.0'
Install failed. Rolling back...
Package 'System.ServiceModel.1.0.0' does not exist in project 'MobileCashRegister'
Package 'System.ServiceModel.1.0.0' does not exist in folder 'C:\dev\DevCuddlUpSolution\packages'
Install-Package : Could not install package 'System.ServiceModel 1.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7', but the package does not contain any assembly
references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
How can I know which profile needs to be selected for the System.ServiceModel nuget package to be installed successfully?
Please note I am using Visual Studio 2015 Professional and the latest available Xamarin.
System.ServiceModel 1.0.0 does not contain any assemblies in any lib folders. It just seems to contain NuGet.exe so you will not be able to use it.
It is also not an official Microsoft NuGet package.
Getting the error "Error CS0234: The type or namespace name CrossCore' does not exist in the namespaceCirrious'. Are you missing an assembly reference?" for PCL. And unable to update packages.
We are getting error when we are trying to update packages in Xamarin studio PCL in Mac machine. “Could not install package 'MvvmCross.PortableSupport 3.2.2'. You are trying to install this package into a project that targets 'portable-Profile78', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.”
If you are updating an old MvvmCross project then that is probably why. Starting with 3.2.1 MvvmCross moved to PCL profile 259. You'll need to change the profile of your pcl core to this profile or something else that is compatible.
After uninstall xamarin by following steps in the url http://developer.xamarin.com/guides/cross-platform/getting_started/installation/uninstalling_xamarin/
and reinstall the Xamarin Studio, the Nuget packages are started updating.