Cannot find Prism.PrismApplication - prism

I just started my first WPF app using MVVMLight, PRISM, and DryIoc. The App.xaml refers to prism:PrismApplication as described in https://prismlibrary.com/docs/wpf/getting-started.html without error.
<prism:PrismApplication x:Class="DYC.MembershipAndDues.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DYC.MembershipAndDues"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:prism="http://prismlibrary.com/"
xmlns:vm="clr-namespace:DYC.MembershipAndDues.ViewModel"
xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
d1p1:Ignorable="d"
DispatcherUnhandledException="Application_DispatcherUnhandledException">
<Application.Resources>
<ResourceDictionary>
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
</ResourceDictionary>
</Application.Resources>
</prism:PrismApplication>
In the App.xaml.cs, Prism.PrismApplication cannot be found. I found PrismApplicationBase in the object explorer, which works for App.xaml.cs, but in App.xaml, prism:PrismApplicationBase cannot be found. There appears to be a disconnect between the xaml declaration at xmlns:prism="http://prismlibrary.com/" and the packages that I have loaded.
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="2.0.5" targetFramework="net472" />
<package id="DryIoc.dll" version="4.0.7" targetFramework="net472" />
<package id="MvvmLight" version="5.4.1.1" targetFramework="net472" />
<package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net472" />
<package id="Prism.Core" version="7.2.0.1422" targetFramework="net472" />
<package id="Prism.DryIoc" version="7.2.0.1422" targetFramework="net472" />
<package id="Prism.Wpf" version="7.2.0.1422" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>
What am I missing?

Found it! It's included in the dependancy injector container, i.e. Prism.DryIoc or Prism.Unity depending on which container you are using.

Related

uninstall nuget package that no longer exists

We had our nuget server die and the admin never made a backup. So now building on a new install won't work b/c there is nothing in the cache and it can't recreate the dependency list. I tried to force uninstall but it says that I have to restore the package before uninstalling it so it can build the dependency tree. Argh. I just want the package out of the solution so we can rebuild the site. I also tried removing it from packages.config but that didn't help.
Is there a way to manually force delete a nuget package without having access to it anymore? Otherwise I need to build a new solution from scratch and migrate the files over.
Here are the commands I tried:
uninstall-package packagename -RemoveDependencies -force
and
uninstall-package packagename -force
Here is the config file:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="custom.serialization" version="2017.3.20.142224" targetFramework="net462" />
<package id="custom.themes.flat-blue" version="2016.12.9105400" targetFramework="net452" />
<package id="Microsoft.AspNet.Cors" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Cors" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net462" />
<package id="NLog" version="4.4.5" targetFramework="net462" />
<package id="NLog.Extended" version="4.0.0.1" targetFramework="net452" />
<package id="NLog.Web" version="4.4.0" targetFramework="net452" />
</packages>
Thanks
Looks like I got it working. Here are the steps:
Close the solution.
Delete references to the package from .csproj file
Delete reference from the packages.config file.
Delete all packages from the packages folder in the root.
Open the NuGet configuration and remove the source that had the old files.
Open the solution and tell it to reload all packages. It will then pull down fresh copies of all packages except the one you deleted.
So far the solutions is building and running without any errors about the missing package!

Web Api built with msbuild does not work due to Microsoft.DiaSymReader.Native assemblies

I recently started running into an issue when building my web api project using MSBuild on VSTS and I managed to reproduce it locally.
My Web Api is a standard, run of the mill api with nothing fancy added.
It has the following packages installed:
<packages>
<package id="Autofac" version="4.5.0" targetFramework="net461" />
<package id="Autofac.Owin" version="4.0.0" targetFramework="net461" />
<package id="Autofac.WebApi2" version="4.0.1" targetFramework="net461" />
<package id="Autofac.WebApi2.Owin" version="4.0.0" targetFramework="net461" />
<package id="AutoMapper" version="6.0.2" targetFramework="net461" />
<package id="CommonServiceLocator" version="1.3" targetFramework="net461" />
<package id="EntityFramework" version="6.1.3" targetFramework="net461" />
<package id="Kentico.Libraries" version="10.0.16" targetFramework="net461" />
<package id="Kentico.Libraries.Dependencies" version="10.0.16" targetFramework="net461" />
<package id="log4net" version="2.0.8" targetFramework="net461" />
<package id="Microsoft.AspNet.Cors" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Tracing" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net461" />
<package id="Microsoft.Net.Compilers" version="2.0.1" targetFramework="net461" developmentDependency="true" />
<package id="Microsoft.Owin" version="3.1.0" targetFramework="net461" />
<package id="Microsoft.Owin.Cors" version="3.1.0" targetFramework="net461" />
<package id="Microsoft.Owin.Host.SystemWeb" version="3.1.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net461" />
<package id="Owin" version="1.0" targetFramework="net461" />
<package id="PagedList" version="1.17.0.0" targetFramework="net461" />
<package id="System.Linq.Dynamic" version="1.0.7" targetFramework="net461" />
</packages>
When I build the project locally using Visual Studio 2015, the API works as expected.
However, when I build the project using msbuild:
msbuild Portal.WebApi.csproj /p:Platform="Any CPU" /p:Configuration="Nightly" /p:VisualStudioVersion="14.0" /p:OutputPath="C:\Temp\BuildOutput"
and point my IIS to the the _PublishedWebsites\Portal.WebApi\ folder, it fails with the following error:
Could not load file or assembly
'Microsoft.DiaSymReader.Native.amd64.dll' or one of its dependencies.
The module was expected to contain an assembly manifest.
If I remove Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers packages from the API project and build it again using MSBuild, the API works again as expected.
If I compare the bin folders (Visual studio build vs MSBuild), the msbuild bin folder has additional dlls and all the content of the roslyn folder is added directly to the bin folder.
Has anyone encountered such an issue?

Packages node does not exist in packages.config

When I try to update Dapper (or any other NuGet package), Visual Studio displays:
An error occurred while writing file 'T:\ProjectPath\packages.config': Packages node does not exists in packages.config at T:\ProjectPath\packages.config.
The exact contents of said file are:
<?xml version="1.0" encoding="utf-8"?>
<packages xmlns="urn:packages">
<package id="Antlr" version="3.5.0.2" targetFramework="net45" xmlns="" />
<package id="Dapper" version="1.42" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" xmlns="" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net451" xmlns="" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" xmlns="" />
<package id="Moment.js" version="2.10.2" targetFramework="net451" xmlns="" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" xmlns="" />
<package id="NLog" version="4.0.1" targetFramework="net451" xmlns="" />
<package id="NLog.Config" version="4.0.1" targetFramework="net451" xmlns="" />
<package id="NLog.Schema" version="4.0.1" targetFramework="net451" xmlns="" />
<package id="Oracle.ManagedDataAccess" version="12.1.021" targetFramework="net451" xmlns="" />
<package id="WebGrease" version="1.6.0" targetFramework="net45" xmlns="" />
</packages>
A package node certainly seems to exist.
I have tried update-package dapper, update-package dapper -Reinstall, and uninstall-package dapper -Force. All yield:
PM> Update-Package dapper
Attempting to gather dependency information for multiple packages with respect to project 'ImplantRecipeDatabase', targeting '.NETFramework,Version=v4.5.1'
Attempting to resolve dependencies for multiple packages.
Resolving actions install multiple packages
Install failed. Rolling back...
Package 'Dapper 1.42' already exists in project 'ImplantRecipeDatabase'
Update-Package : An error occurred while writing file 'T:\Dropbox\WorkProjects\DataManager\ImplantRecipeDatabase\packages.config': Packages node does not exists in packages.config at T:\Dropbox\WorkProjects\DataManager\ImplantRecipeDatabase\packages.config.
At line:1 char:15
+ Update-Package <<<< dapper
+ CategoryInfo : NotSpecified: (:) [Update-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand
Note that the most recent version of Dapper found by NuGet as of this writing is 1.50.1
The errors aren't helpful, so I am not sure where to go from here. I have tried installing the most recent update for VS2015 Update 3 (kb3165756) and have the most recent version of NuGet (3.4.4.1321).
What should I try next?
Your packages.config file does not look correct. It has xmlns attributes where a normal packages.config would not have any. Having the root packages element in a different namespace may well be the cause of the problem. I would expect the packages.config file to look more like:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net45" />

Could not load type 'Xamarin.Forms.Preserve Attribute' from assembly 'Xamarin.Forms.Core'

I've just inherited an old Xamarin Forms application and I'm trying to upgrade all the packages. App was initially running fine, but since upgrading to the latest version of all packages, I'm now getting a crash calling Xamarin.Forms.Forms.Init(this, bundle);:
Could not load type 'Xamarin.Forms.PreserveAttribute' from assembly 'Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
Here's my packages.config file contents:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ExifLib.PCL" version="1.0.1" targetFramework="MonoAndroid50" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="MonoAndroid50" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="MonoAndroid50" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="MonoAndroid50" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="MonoAndroid50" />
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="MonoAndroid50" />
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="MonoAndroid50" />
<package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="MonoAndroid50" />
<package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="MonoAndroid50" />
<package id="Xamarin.Android.Support.v7.CardView" version="23.3.0" targetFramework="MonoAndroid50" />
<package id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0" targetFramework="MonoAndroid50" />
<package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="MonoAndroid50" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="MonoAndroid50" />
<package id="Xamarin.Forms" version="2.3.0.38-pre2" targetFramework="MonoAndroid50" />
<package id="Xamarin.Forms.Labs" version="1.2.1-pre2" targetFramework="MonoAndroid44" />
<package id="Xamarin.Forms.Maps" version="2.2.0.31" targetFramework="MonoAndroid50" />
<package id="Xamarin.GooglePlayServices.Base" version="29.0.0.1" targetFramework="MonoAndroid50" />
<package id="Xamarin.GooglePlayServices.Basement" version="29.0.0.1" targetFramework="MonoAndroid50" />
<package id="Xamarin.GooglePlayServices.Maps" version="29.0.0.1" targetFramework="MonoAndroid50" />
<package id="Xamarin.Insights" version="1.12.3" targetFramework="MonoAndroid50" />
</packages>
I closed Xamarin Studio and cleared obj and bin folders and started Xamarin Studio again and everything worked fine
I had the same issue but I noticed that the Xamarin.Forms package had an update. I updated this package and the issue went away.
I had the same message from a freshly created default Xamarin Forms app (Native, with Portable Class Library) after adding a new Form to the PCL (via the "Add New Item" context menu in Visual Studio and selecting Xamarin.Forms/Content Page).
It turned out that the packages.config in the PCL specified a different version for Xamarin.Forms than the one in UWP project.json file.
Making both projects use the same version of Xamarin.Forms by editing the packages.config fixed the problem.
The path of project must have not '#' character
In my case i had downgraded the Xamarin version from 3.x to 2.5 for all the projects. But somehow the .Net Standard project was not downgraded.
Started working after downgrading the .net standard project.

Why Microsoft.Owin.Host.SystemWeb failed to install?

I started with an empty solution with Web API only. (no mvc)
Using NuGet to upgrade all the built-in packages to the latest stable.
Then,
Install-Package Microsoft.AspNet.WebApi.Owin
Everything's good. I get a version 5.2.2 of Microsoft.AspNet.WebApi.Owin.
After that, install Owin.Host.SystemWeb.
Install-Package Microsoft.Owin.Host.SystemWeb
It shows a Successfully installed... message. But when I look into the References of the project, the icon before Microsoft.Owin.Host.SystemWeb has a yellow triangle in its bottom.
Here is my packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.WebApi" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.Owin" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.6" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
</packages>
The solution can be built but with a Warning, not even an error:
The referenced component 'Microsoft.Owin.Host.SystemWeb' could not be found.
The question: what is the correct way to install Microsoft.Owin.Host.SystemWeb? Is there some version requirement?
Try changing
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.0" targetFramework="net45" />
to
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.0" targetFramework="net452" />

Resources