Xamarin Forms, no unitybootstrapper - xamarin.forms

I figure this should be very simple to fix but this is driving me totally crazy because I can't find any information about this problem.
I have created a "Blank APP (Portable)" in VS2015.
Next I used NuGet package manager to update and or install:
Xamarin.Forms v2.3.1.114
Prism.Core & Prism.Forms & Prism.Unity.Forms v6.2.0
Unity v4.0.1
--
So I want to create a bootstrapper that derives from the "UnityBootstrapper" however it can't seem to find it and suggesting to me to generate a new class.
Here are the references:
In which Assembly can I find this UnityBootstrapper?
In all the tutorials there seems to be no problem inheriting from the unitybootstrapper.

There is no more bootstrapper. As noted in the release notes, this has been removed.
https://github.com/PrismLibrary/Prism/wiki/Release-Notes-6.2.0
You should be using PrismApplication now. Also look at the getting started in the docs
https://github.com/PrismLibrary/Prism/blob/master/Documentation/Xamarin.Forms/1-GettingStarted.md

Related

Getting image from Class Library

I am doing a refactor of my Xamarin project, in which I want to build nuget-packages for my platform specific projects.
And since you can't make your "App.Droid", "App.iOS" and "App.UWP" into nugets I am using class libraries for this.
My problem is when I put my images (ordinary *.png-files) in my UWP-class library it won't work. It is working in both iOS and Android.
So my question is if anyone knows if this is possible, and if so how?
My current setup is as follows:
My UWP-project is named "App.UWP". This is the project i build and the project has the "App.xaml" and "MainPage.xaml".
I then created a "Class library (Universal Windows)" named "Company.Mobile.Core.UWP".
My "App.UWP" is referencing "Company.Mobile.Core.UWP".
I know I have a working connection between the two. My Custom renderers are in the "Company.Mobile.Core.UWP"-project and not in "App.UWP" and is working fine.
Cheers,
Tobias

VS2017 Could not load file or assembly Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll or one of its dependencies

When trying to open an older solution in VS2017 there is an old Unit Test project that is giving me a problem when building.
I keep getting the following error when building this test project:
Could not load file or assembly 'file:///C:\Projects\MyProj\Test\DAL\UnitTestProj\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll' or one of its dependencies. The system cannot find the file specified.
I checked the project's references and it appears to be referencing Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll. Additionally there are no code errors. How could I ever figure out if it is one of its dependencies that it can't find?
I had a similar issue (with the additional message The "BuildShadowTask" task failed unexpectedly) with a project originally developed with VS2010, and got to spend the last few hours learning about yet another legacy facet of the build process.
There is a good chance that you are dealing with private accessor files (.accessor), which were deprecated in VS2012 (original source). This was foreshadowed in an announcement from the VS2010 team that they were no longer working on these features.
There is also a chance you're just dealing with erroneous refs to the wrong version of UnitTestFramework, but a NuGet restore should fix this. If not, see this GitHub thread for a possible fix (manually change the ref to the public folder), or move to the new MSTest.TestAdapter and MSTest.TestFramework packages (see MSDN support thread).
Solutions
A. Edit the unit test .csproj and change the item Include references from Shadow => None:
<Shadow Include="Test References\namespace.accessor" /> to
<None Include="Test References\namespace.accessor" />
B. Better yet, simply delete all the .accessor files from the unit test project's Test References folder.
Ideally, you would also rewrite your unit tests to remove references to private methods, either by re-architecting to separate concerns or by changing properties to internal and using "friend" with the InternalsVisibleToAttribute.
For those who need to continue supporting testing of private methods for some reason, the same post provides the following suggestions to the logical question "What is available for me then?":
For those who wish to continue testing internal APIs, you have three options:
Use the Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject class to assist in accessing internal and private APIs in your code. This is found in the Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll assembly.
Create a reflection framework that would be able to reflect off your code to access internal or private APIs.
If the code you are trying to access is internal, you may be able to access your APIs using the InternalsVisibleToAttribute so your test code can have access to the internal APIs.
However, there is not any good replacement for Code Generation for the new features added by the lanugage teams. You may create the TestMethod stubs and then remove the internal code. You only need to keep the stub itself.
Further reading / sources that helped me piece this together:
VS 2005 ASP.NET explanation of accessors
2008 blog article explaining how to work around this for build servers
MSDN forum thread with discussion on accessor purposes, implementations, and workarounds. Start about 1/3 down.
MSDN BaseShadow docs
MSDN PrivateObject class
Right click the project references folder. Add reference > Assemblies > extensions. Check Microsoft.VisualStudio.QualityTools.UnitTestFramework 10.1, and uncheck any older version.
This is related to Visual studio Enterprise 2015, add new load test was failing: and spiting as "Unable to find assembly 'Microsoft.VisualStudio.QualityTools.LoadTest, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Due to Assembly installed in public assemblies shows as version 10.0.0.0 which is missed in GAC,
GAC had only 10.1.0.0. Once GAC updated with 10.0.0.0 and restart VS 2015. should resolve the issue similar to this.
Some more detail for better reasoning, System Assembly path and project path
DLL path
......\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
.CSProj reference version
I had a same issue while I was upgrading project to .Net4.8 in Visual studio 2022 earlier we were using Visual studio 2017.
Error:
The "BuildShadowTask" task could not be loaded from the assembly ***\Microsoft.VisualStudio.TestTools.BuildShadowsTask.dll. Could not load file or assembly 'file:///***Microsoft.VisualStudio.TestTools.BuildShadowsTask.dll' or one of its dependencies.
Solution : I removed ".accessor" files from project as that is being used for accessing private methods(most probably accessor is depricated). Then we used "PrivateObject" class for accessing private members in UnitTest.
Later we updated Unit Test case. Code references could be found from below articles.
Unit test private methods?
Unit Testing: Exposing Private Members
I had a similar issue (compile project in server Jenkins)
Solution:
Include VS.QualityTools.UnitTestFramework to reference project, whit Pakage Manager:
PM>NuGet\Install-Package VS.QualityTools.UnitTestFramework -Version 15.0.27323.2
https://www.nuget.org/packages/VS.QualityTools.UnitTestFramework
Try to fully uninstall Visual Studio 2017 (not repair). Then download the latest version and install it. Remember to check if MSBuild is added to installation files. Remember to delete folder inside Documents: Documents\Visual Studio 2017. In my case, this simple solution fixed all errors.

IdentityServer4.Services.InMemory not working

I google a lot but not find any solution. Below is my problem :
I make a simple project where I use reference "IdentityServer4.Postgresql": "1.0.0"
where "using IdentityServer4.Services.InMemory" works perfectly.
But when I use "IdentityServer4.Postgresql": "2.0.0" then IdentityServer4.Services.InMemory always shows error.
That means version 2 of IdentityServer4.Postgresql not support IdentityServer4.Services.InMemory.
How can I use IdentityServer4.Services.InMemory for "IdentityServer4.Postgresql": "2.0.0"?
Thanks in advance.
IdentityServer4.Postgresql is not a part of the IdentityServer project, but sounds like a community contribution. You may have a better result by contacting the library creator.
Otherwise, you could try the official IdentityServer4.EntityFramework package that is maintained by the IdentityServer team in combination with an Entity Framework Core database provider for PostgreSQL.
The official quickstarts only show adding Entity Framework in the 8th quickstart. You'll have to do each one in succession up to the eighth one to fully understand / make sure to have the code you need.
After you have Entity Framework added to the configuration, you can support a Postgres database by just adding dependencies.

Inishtech / Software Potential Code Protector integration with Visual Studio build or Setup project

Have anyone tried InishTech Software Potential Code Protector ?
Can we integrate this with our build programmatically? I found tutorials but those were to do with the help of the Code Protector standalone GUI. What I want to know is do they have an SDK so that we can integrate with our code or some perfect tutorial which can opt-out dependencies from our setup.
UPDATE: There's been a Getting Started guide that covers code Protection added since I wrote the answer. (Exec summary: You add 2 NuGet packages and then put attributes on what you want to protect and protection is automatically integrated into the build process, be that from within Visual Studio or on a Build Server. Key simplifications are that you no longer need to add a SLPS_PROTECT Symbol or install an SDK anywhere.)
You can use the automatic Protection during building as detailed in the relevant KB article.
This hooks in an MSBuild-based build extension which will feed each assembly EXE/DLL as you compile it into the Command-Line Code Protector when you #define SLPS_PROTECT in Project| settings|Build tab|General area|Conditional compilation symbols (you might only want to do this for the Release configuration).
The Protected code then continues on its way, e.g., into your Setup Project or WebDeploy package.
Typically when using this approach, you declaratively mark the Feature to be associated with each Protected Method using the [Feature] attribute:-
[Feature]
void ProtectedCode()
{
...
}
You may also find further relevant details in the knowledgebase, FAQs and in the forum.
UPDATE: There's a new http://docs.softwarepotential.com/ which provides more focused getting started guides than there were at the time I answered the question. There are also a set of samples up at: https://github.com/SoftwarePotential/samples including installer-related ones.
Any further questions, please feel free to ask - either here or on the forum.
Disclaimer: I work for InishTech.
Code Protector is fantastic product from InishTech
I am using this for my startup and it works great and do it's job extensively well
just go for it

Ninject with MVC3 RTM

I've upgraded MVC3 from RC2 to RTM. We were using Ninject 2.1.0.76, but things stopped working once I upgraded. So I used the NuGet manager to get the latest Ninject, Ninject.MVC3 and Ninject.Web.Mvc libraries (2.1.0.91, 1.0.0.0 and 2.1.0.39 respectively). Now, it creates an AppStart_NinjectMVC3 file.
I removed NinjectHttpApplication from my global.asax and made it back into a regular HttpApplication. When I tried to build, I get;
"Exception has been thrown by the target of an invocation"
Looking further, if I disable the following line;
DependencyResolver.SetResolver(new NinjectServiceLocator(kernel));
The build goes through. But I'm pretty sure I don't want to do this.
Any ideas?
----- UPDATE ---------
I created a new MVC3 project, added the reference to Ninject.MVC3 and this builds and runs fine. I compared web.config, don't see any differences that relate to Ninject or MVC in the two. A fresh project doesn't add the Ninject.Web.Mvc library, so I removed it and commented out all code relating to that, and still, the error occurs.
Since ASP.NET MVC 3 Beta the IServiceLocator interface is replaced by IDependencyResolver. I'm not sure Ninject.MVC3 already has a release where they have implemented this interface.
Judging from the line DependencyResolver.SetResolver(new NinjectServiceLocator(kernel)) it appears they have not.
Here's a simple implementation of this interface for Ninject.
UPDATE: The Ninject.Web.Mvc library has a NinjectDependencyResolver class that extends from the IDependencyResolver interface. I think you should use this one (I do and everything works fine).
Download the dlls from here
https://github.com/ninject/ninject/archives/master
https://github.com/ninject/ninject.web.mvc/archives/master
Further more do not use Ninject.MVC3 all you need ist Ninject.Web.Mvc
I also have an article documenting same here

Resources