When restoring NuGet packages I see that Xamarin.ios.CameraViewController is restored to my package and with it, all its dependencies. But I never referenced Xamarin.ios.CameriaViewController nor it is a dependency of my referenced packages.
My csproj nuget references:
<ItemGroup>
<PackageReference Include="Acr.UserDialogs">
<Version>7.0.3</Version>
</PackageReference>
<PackageReference Include="CarouselView.FormsPlugin">
<Version>5.2.0</Version>
</PackageReference>
<PackageReference Include="DLToolkit.Forms.Controls.FlowListView">
<Version>2.0.11</Version>
</PackageReference>
<PackageReference Include="GMImagePicker.Xamarin">
<Version>2.3.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.Net.Http">
<Version>2.2.29</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.1</Version>
</PackageReference>
<PackageReference Include="Plugin.FacebookClient">
<Version>1.4.0</Version>
</PackageReference>
<PackageReference Include="Plugin.FileUploader">
<Version>1.4.0</Version>
</PackageReference>
<PackageReference Include="Plugin.GoogleClient">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Remote.Linq.Newtonsoft.Json">
<Version>5.8.2</Version>
</PackageReference>
<PackageReference Include="Rg.Plugins.Popup">
<Version>1.1.5.188</Version>
</PackageReference>
<PackageReference Include="SQLite.Net.Async-PCL">
<Version>3.1.1</Version>
</PackageReference>
<PackageReference Include="SQLite.Net.Core-PCL">
<Version>3.1.1</Version>
</PackageReference>
<PackageReference Include="Syncfusion.Xamarin.SfAutoComplete">
<Version>16.4.0.54</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.Connectivity">
<Version>3.2.0</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.Media">
<Version>4.0.1.5</Version>
</PackageReference>
<PackageReference Include="Xam.Plugins.Forms.ImageCircle">
<Version>3.0.0.5</Version>
</PackageReference>
<PackageReference Include="Xam.Plugins.Messaging">
<Version>5.2.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Essentials">
<Version>1.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="3.4.0.1029999" />
<PackageReference Include="System.Reflection.Emit">
<Version>4.3.0</Version>
<ExcludeAssets>all</ExcludeAssets>
</PackageReference>
<PackageReference Include="Xamarin.Forms.ImagePicker">
<Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.iOS.SignIn">
<Version>4.4.0</Version>
</PackageReference>
<PackageReference Include="Xamd.Plugins.Forms.ImageCarousel">
<Version>1.0.2</Version>
</PackageReference>
<PackageReference Include="Xfx.Controls">
<Version>1.1.3</Version>
</PackageReference>
</ItemGroup>
So why is it referenced? how can I remove it?
It's a dependency of Xamarin.Forms.ImagePicker.iOS, which is a dependency of Xamarin.Forms.ImagePicker.
with package references being maintained in the project file, only
top level dependencies are listed there, i.e. packages you have
explicitly added.
Now, packages can depend on other packages. These
package become your transitive dependencies - Packages that you did
not add explicitly but now you depend on them implicitly.
Most times you don't care too much about them which is why they don't show up in
the list of installed packages i.e. top level dependencie.
You can however, take a look at all your dependencies inclusing transitive ones -
open the obj directory for your project. You'll see projects.assetes.json You'll see something like
"Microsoft.NETCore.UniversalWindowsPlatform/6.2.8": {
"type": "package",
"dependencies": {
"Microsoft.NETCore.Platforms": "2.1.0",
"Microsoft.Net.Native.Compiler": "2.2.3",
"Microsoft.Net.UWPCoreRuntimeSdk": "2.2.8",
"NETStandard.Library": "2.0.3"
}
In that example, Microsoft.NETCore.UniversalWindowsPlatform is a package that you installed explicitly and would see in your csproj references but it also brings in a bunch of its own dependecies i.e. Microsoft.NETCore.Platforms, Microsoft.Net.Native.Compiler, etc.
Related
I have my old workable xUnit test project. It was worked fine in another computer with VS2019. But in another computer with VS2022 project don't start. I have recreated project again, reinstall Net Core SDK, a couple of time restart my computer and Visual Studio. But any my attempt was filed.
This is my project file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>BackendApiTest1</RootNamespace>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="BackendAPI">
<HintPath>..\..\..\BackendAPI\BackendAPI\bin\Debug\net5.0\BackendAPI.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
Test project
Project build without errors. Menu on test explorer opened once, I can click run or debug and after that never happens.
..........
general info:
OS: Linux mint Debbie
code-editor: vs code
tutorial i'm following :https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/adding-model?view=aspnetcore-3.1&tabs=visual-studio-code
...........
when i run:
dotnet aspnet-codegenerator -h
i get this(and the options/args list) :
No code generators are available in this project. Please add the 'Microsoft.VisualStudio.Web.CodeGeneration.Design' NuGet package to the project.Please add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.
the package is already added here us the csproj file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SQLite" Version="3.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
</ItemGroup>
</Project>
when i try to create a a view I (predictably) get this:
dotnet-aspnet-codegenerator view -name myView
i get:
Building project ...
Finding the generator 'view'...
No code generators found with the name 'view'
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGeneratorsLocator.GetCodeGenerator(String codeGeneratorName)
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
I have a multi-project solution that was working fine in VS2017, I've installed VS2019 and on compile I receive five error messages:
Four of the format: This version of Microsoft.AspNetCore.App is only compatible with netcoreapp2.2 taret framework. Please target netcoreapp2.2 or chose a version of Microsoft.AspNetCore.app compatible with netcoreapp3.1
And one of the format: Project '..\project-path\project.csproj' targets 'netcoreapp3.1;. It cannot be reference by a project that targets '.NETCoreApp,Version=v2.2'
Additionally if you look at the projects referenced in the error messages the Dependencies, Packages, SDK all have the yellow warning symbol on them (hover and right-click don't seem to provide additional details)
I've tried cleans, delete bin and obj folders, rebuilds, checking SDK versions, but no luck
I can confirm I have a global.json with the SDK version (2.2.103) and that when in any of these projects directories and I run 'dotnet --verson' I get back 2.2.103
What is happening here? What / where is it picking up netcoreapp3.1 from and how do I resolve these errors?
Update: CSPROJ Details
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Include="appsettings.json" CopyToOutputDirectory="Always" />
<None Include="favicon.ico" CopyToOutputDirectory="Always" />
<None Include="appDevLocalOverride.json" />
<PackageReference Include="Lamar.Microsoft.DependencyInjection" Version="3.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.8.1" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.AzureKeyVault.HostingStartup" Version="2.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="3.1.2" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.3" />
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
</ItemGroup>
I'm not sure why or how this works, but I have stumbled on a solution:
Open the csproj
Edit <PackageReference Include="Microsoft.AspNetCore.App" /> to <PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
Build > Clean Solution
Manually remove ALL bin and obj folders (even if they are only remotely related to the solution)
Build > Rebuild Solution
Edit <PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" /> to <PackageReference Include="Microsoft.AspNetCore.App" />
That seemed to work for me, why a simple Clean Solution and Rebuild wasn't the answer is odd; but hopefully this will help someone else!
On Xamarin Forms I am using Prism MVVM.
After doing some update these two package Microsoft.AspNetCore.SignalR.Client 1.1.0->3.0.0 and Microsoft.Extensions.Caching.Memory 2.2.0->3.0.0 my application showing only white screen.
Can not see login page.
I only update these two package. Deleted bin and obj folder and it did not help
Other packages version:
Prism.Forms-> 7.2.0.1367
Xamarin.Forms ->4.2.0.815419
Any idea ?
EDIT:
All package I am using :
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.Memory">
<Version>3.0.0</Version>
</PackageReference>
<PackageReference Include="NdefLibrary">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="Prism.Core">
<Version>7.2.0.1367</Version>
</PackageReference>
<PackageReference Include="Prism.Forms">
<Version>7.2.0.1367</Version>
</PackageReference>
<PackageReference Include="Prism.Plugin.Popups">
<Version>7.2.0.573</Version>
</PackageReference>
<PackageReference Include="Prism.Unity.Forms">
<Version>7.2.0.1367</Version>
</PackageReference>
<PackageReference Include="Rg.Plugins.Popup">
<Version>1.1.5.188</Version>
</PackageReference>
<PackageReference Include="System.Buffers">
<Version>4.5.0</Version>
</PackageReference>
<PackageReference Include="System.Memory">
<Version>4.5.3</Version>
</PackageReference>
<PackageReference Include="Xam.Plugins.Notifier">
<Version>3.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Essentials">
<Version>1.3.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.2.0.815419" />
<PackageReference Include="Xamarin.Forms.Visual.Material">
<Version>4.2.0.815419</Version>
</PackageReference>
<PackageReference Include="Xamarin.HotReload">
<Version>1.4.19</Version>
</PackageReference>
<PackageReference Include="ZXing.Net.Mobile">
<Version>2.4.1</Version>
</PackageReference>
<PackageReference Include="ZXing.Net.Mobile.Forms">
<Version>2.4.1</Version>
</PackageReference>
</ItemGroup>
EDIT : Found new error
Now I am getting these error. I got this error first removed signalR and readded it and checked the all "Common Language Runtime Exceptions"
System.TypeLoadException: 'Could not load type of field
'Microsoft.AspNetCore.Http.Features.Authentication.HttpAuthenticationFeature:<Handler>k__BackingField' (1)
due to: Could not resolve type with token 01000080 from typeref (
expected class 'Microsoft.AspNetCore.Http.Features.Authentication.IAuthenticationHandler' in assembly
'Microsoft.AspNetCore.Http.Features, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60')
assembly:Microsoft.AspNetCore.Http.Features, Version=2.2.0.0, Culture=neutral,
PublicKeyToken=adb9793829ddae60 type:Microsoft.AspNetCore.Http.Features.Authentication.IAuthenticationHandler
member:(null)'
in debug windows
**System.TypeLoadException:** 'Could not load type of field 'Microsoft.AspNetCore.Http.Features.Authentication.HttpAuthenticationFeature:<Handler>k__BackingField' (1) due to: Could not resolve type with token 01000080 from typeref (expected class 'Microsoft.AspNetCore.Http.Features.Authentication.IAuthenticationHandler' in assembly 'Microsoft.AspNetCore.Http.Features, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60') assembly:Microsoft.AspNetCore.Http.Features, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 type:Microsoft.AspNetCore.Http.Features.Authentication.IAuthenticationHandler member:(null)'
**System.Reflection.TargetInvocationException:** 'Exception has been thrown by the target of an invocation.'
**Unity.ResolutionFailedException:** 'For more information add Diagnostic extension: Container.AddExtension(new Diagnostic())'
**Prism.Navigation.NavigationException:** 'An error occurred while resolving the page. This is most likely the result of invalid XAML or other type initialization exception'
**Prism.Navigation.NavigationException:** 'An error occurred while resolving the page. This is most likely the result of invalid XAML or other type initialization exception'
In the pages code behind wrap the initialiseComponent() in a try catch and see what the error is with a breakpoint. White screen usually means Xaml issue
I have this packages in a project:
<PackageReference Include="Microsoft.CodeAnalysis" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="1.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="2.8.2" />
I moved this .csproj file to 2017 format, and then, when I build the solution, there is an error:
error CS0104: 'Project' is an ambiguous reference between
'Microsoft.CodeAnalysis.Project' and 'Some.Namespace.Project'
Of course, this error is because one of the packages described above moved to parent common project and conflicts with class with the same name.
My question is which assets (IncludeAssets, ExcludeAssets, PrivateAssets) should I set, with what value, and in which package?
For now, the .csproj file looks like this:
<PackageReference Include="Microsoft.CodeAnalysis" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="1.1.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
But I think that this is not the best and precise option.
The best thing to do here is to create a brand new blank project. Make a reference to the 2.8.2 version then compare what is in the csproj file against your real solution. Remove any references in your real solution that are not In your dummy file. It may well be that namespaces have changed, but at least once you get the references right, namespaces shouldn't be so difficult.