I'm developing Windows Store Universal app that uses Azure to store data.
In Visual Studio, there is four projects (Windows, Windows Phone, Shared, Mobile Service).
In Shared projects there is a class ToDoItem.cs. I want it to be used by all projects to avoid code repetition.
The problem I have is that I cannot add a reference to ToDoNotes.Shared in MobileService project. If I do it the other way round, that is, if I have this class in MobileService and reference it in Windows and Windows Phone projects I hit the same problem.
Is it possible to share this class across all projects?
An Azure project can only reference a classic class library... Universal Apps can only reference portable class libraries so you can not reference the code in this manner... There is one trick left in the arsenal, that is to add the file to both the shared project and the azure project as a link. This will link the file to the azure project Instead of copying the file into the azure project folder directory. See Photo below
The hard part will be trying to use the same code because certain objects have been moved from one namespace to another between universal apps and standard.net such as the XmlDocument, httpclient etc. Your code may have quite a few ifdef statements and this might end up being more trouble than it is worth.
Assuming ToDoItem.cs is like a object model, it should be put in a strongly named class library that can be referenced to from any project
Related
I have a Visual Studio solution. This solutions contains two projects. The first is a class library with all methods that communicate with sql server db. The second is a windows service project will run every 30 minutes.
How do I distribute this setup in one package?
I have tried:
1-adding the class library as a reference to windows service.
2-create a setup project and adding the windows service in the application folder.
3-adding the windows service and the class library to the application folder.
this is a screenshot for the error.
I think this error because the class library couldn't reach the SQL db.
You are looking to deploy a windows service that is dependent on a DLL.
"deploy" is the standard for what you're calling "distribute". You understand the underlying concept but just realize that the standard is called "deploy".
There are details to do this here...
Windows Service Deployment
How is it possible to create and build some activities as dynamic link library (DLL) which can be used in other apps.
Imagine I develop an android app in xamarin that has some activities. I want to import some other activities later in main app after I published it. This means that for example when a user purchases a special possibility in my app then app downloads related dll (that contain activities, resources, . . .) and placed it in proper app stored data folder which after that app can uses its contained components.
Unfortunately you cannot create something like "plugin-DLL". You can create a separate app that will act as a "extension" and call its services from your app. A tutorial on how to do this is available for exmple in this blog post.
I have an existing project for Windows 10 (UWP).
It creates an app that can go into Windows Store and be sideloaded, and that works fine.
... but now I would like to create a desktop-version (an exe-file) from the same code base (to avoid sideload-security issues in local network).
I created a VS 2015 4.5.2 WPF project and started to reference the components (dll's) used in the UWP project. But the importer states that some of the components depends on .Net-Core, and cannot be referenced.
So: Is it possible to mix .NET-Core and .NET-Framework components in the same WPF project?
Or: Can I create a .Net-Core console-app, create the used windows, use XAML, and export an exe (with dependencies) that can run standalone?
Thx!
Unfortunately what you are tying to achieve is not possible.
UWP and WPF are different stacks and unless you are using PCLs code cannot be shared between them.
Even then, the XAML layer is different and not compatible from one stack to another.
So no, you cannot reuse your code in a WPF application
As for the other solution, you cannot have your UWP app run as an .exe because Universal Apps run a different Application Model called appx which is fundamentally different than the exe application model.
There are ways to wrap an exe application in an appx (See the Desktop App Converter) but there is no converter/repackager to take you from appx to exe.
I'd like to create a small Web-Service on my Raspberry Pi2, which uses the Project Types "Universal Windows".
The Problem is, I'd like to contact this Web-Service via an App running on my PC. Since this is using the LyncSDK, it has to be a Classic Windows App.
My problem: I'd like to have a shared Model-Assembly to assure I use the same Objects for the Serialization.
In this Assembly I'd need to use the Windows.UI.Color-Enum: https://msdn.microsoft.com/en-us/library/windows/desktop/bb189018.aspx
The closest Project-Type I found so far, was the "Class Library (Portable for iOS, Android and Windows), but I can't use the mentioned Enum.
Is there some Project, which bridges this Gap? The other Workarround I see so far is to save the RGB-Values.
I'am new to Mono and currently working on Mono for Android. I want to re-use the core or services layer so I created a separate project for services layer so I can use it later for iPhone and Windows mobile apps. In the services project there are some references to the web services which are call for various transactions.
When I try to call the the web service by referencing the services project from a Mono Android application I revived "System.TypeLoadException: Could not load type xxxx" exception.
The web services and the service project are working fine when tried it with a simple windows app.
Is there any way to achieve this.
I tried to link classes as mentioned in following article .
http://docs.xamarin.com/Android/Guides/Application_Fundamentals/Building_Cross_Platform_Applications/Sharing_Code_Options
Bit I found that web service referenced and resource file references, etc are not referring when you link a class. Example if I link a class in project B from Project A, if the class has web service calls and referenced resource files, once you linked to project A you'll get build errors. Saying the web services and resource files are can not be found. I linked the resource files as well. But still I revived the same errors.
Any help on these issues are greatly appropriated. Thanks.
If you are any good at French... then the sample at http://www.e-naxos.com/Blog/post/Strategie-de-developpement-Cross-Platform-Partie-2.aspx (and http://www.e-naxos.com/Blog/post/Strategie-de-developpement-Cross-Platform-Partie-3.aspx) has some good information on sharing web service references between windows, windowsphone and monodroid
The key thing the author does is to import the web references separately for the two different paltforms - and to then use one #if to separate the different code.
I did start translating it... https://docs.google.com/document/d/1UQsy80qmXkVO7BRUb3f3vUxO2uQz9af1_PIQykAGzJA/edit - but pigeon English at best I'm afraid!