MVC4 and resources from another project - asp.net-mvc-4

How can I use resource file from another ASP.NET MVC 4 project, please?
Unfortunately, the Web project doesn't see the Resource project.
Thank you.
EDIT
Solution 'Example'
+Example.Resources
+Resources.en.resx
+Resources.resx
+Example.Web
...
I have added the reference of Example.Resources to the Web project, but I can't use the resources because it doesn't see it:
using Example.Resources doesn't exist in the Web project.

You need to create one class library project and add the resource file in that project.
And add the reference your class library project to whenever you want so it will able to use this resource file in your target project.
Like Syntax :- ViewBag.IsUpdate = SurveyTool_Resources.GeneralResources.LUpdate;
GeneralResources is resource file name and SurveyTool_Resources is resource project name.
.
Check Below Image.

Related

Xamarin.Android: Binding aar file not Generation AWS Configured Class

I am Newbie to Xamarin. I am here using my aar file for binding it to xamarin.android. In a Service I have used TransferListener but due to that class won't be generated while building xamarin app after removing Listener, it is working fine.
Description Edited:
I have created library in android. Now trying to bind generated aar file to xamarin. But after building project inside generated dll file, I am unable to find a class which has implemented TransferListener of AWS. When I remove TransferListener from there, I found that class.
Thanks in advance.
If you are looking for Amazon AWS cloud connection the following are the links that you need to check :
https://docs.aws.amazon.com/mobile/sdkforxamarin/developerguide/setup.html
https://docs.aws.amazon.com/mobile/sdkforxamarin/developerguide/Welcome.html
https://aws.amazon.com/blogs/aws/new-aws-mobile-sdk-for-xamarin/
https://docs.aws.amazon.com/mobile/sdkforxamarin/developerguide/getting-started-xamarin.html\
https://blog.xamarin.com/amazon-web-services-aws-mobile-sdks-for-xamarin-now-available/
https://forums.xamarin.com/discussion/96342/implementing-aws-cognito-identity-services-in-xamarin-android
https://components.xamarin.com/view/aws-cognitoidentity-sdk

frame.navigate to a page in different .dll

I have a Page class in a project A. I want to navigate to this page from my Universal windows project(say Project B) page. In UWP I am trying to achieve this using Frame.Navigate(typeof(Page_classA)), since NavigationService.Navigate(new Uri()) is obsolete in UWP.
But I get a Windows.UI.Xaml.Markup.XamlParseException in this case.
Is there any other way in UWP or metro Apps for navigating to a page in different assembly?
We can use Frame.Navigate(TypeName) method to navigate to a page in different assembly.
For example, we can create a Class Library(Universal Windows) named "ProjectA" and in this project add a new Page named "PageA". Then in this project's Properties page, check the "Generate library layout" option in the Build configuration.
In WinRT environment, the resources are no longer embedded in the assembly but are placed next to the dll as content. So we need to generate library layout so that we can reference the dll in other project conveniently.
After this, we can build the project and we will get following layout in "Debug" folder:
In ProjectA folder, it contains .xaml file and .xr.xml file:
When we get the library output files, we can copy them to anywhere and in the Universal Windows Project(Project B), we just need to add reference to the "ProjectA.dll" file. Visual Studio will automatically pick these files up and put them in the appx package when it builds the app.
And in Project B, we can use following code to navigate to PageA:
Frame.Navigate(typeof(ProjectA.PageA))
In your case, you get a Windows.UI.Xaml.Markup.XamlParseException, this may be that the .pri file is missing when you add the reference. Here is a similar case. So please check your library layout and make sure these resources are are placed next to the dll you referenced.

ASP.NET 5 System.Runtime.Caching

I am converting an existing .Net 4.5 MVC 5 project to a new ASP.NET 5 project. One of my files is referencing the System.Runtime.Caching namespace but on moving this file to the new project this namespace cannot be found.
I have added System.Runtime as a dependency in the new project, but the .Caching bit seems to be missing from this. Has anybody experienced a similar problem?
You need to bring in 'Microsoft.Extensions.Caching.Memory' using the following line in your project JSON.
"dependencies": {
"Microsoft.Extensions.Caching.Memory": "1.0.0"
}
Current documentation can be found here.
https://docs.asp.net/en/latest/performance/caching/memory.html
To use the System.Runtime.Caching namespace in an ASP.NET application, you must add a reference to the namespace.
To add a reference to the Website
In Solution Explorer, right-click the name of the Web site and then
click Add Reference.
Select the .NET tab, select System.Runtime.Caching, and then click
OK.
Ref: https://msdn.microsoft.com/en-us/library/ff477235(v=vs.110).aspx#Anchor_2

How to generate XML documentation file in ASP.NET 5

I am interested how can I create XML documentation file in VS2015 with ASP.NET MVC6 project? In older project types there was a checkbox called XML documentation file when you do right click on Properties -> Build.
You don't need to do anything special, it generates it by default and puts it inside the NuGet package for you.
Refer to here if you want to see where exactly this happens.

Custom class in DotNetNuke Module

I know this can be done as there are other modules out there that have this, but I'm just not getting it to work.
I have created a custom module for a DotNetNuke site. I want to be able to create a class object within the module to hold the information about that object. I can create the object and everything complies. But when I go to use the object in the code-behind it states that the object is not defined. I'm not really sure where to go from here.
This is the beginning of the View.ascx.vb :
Namespace Modules.VacationForms
Public MustInherit Class View
Inherits PortalModuleBase
This is the object class beginning:
Namespace Modules.VacationForms
Public MustInherit Class Vacation
I'm really not sure why this is not working. I did download another module code to compare and as far as I can tell everything is the same. Any help is appreciated.
Are you using a Web Site Project or a Web Application Project? The Web Application project will allow you to compile all of your code together (the only issue here might be the the Root Namespace setting in your project, but, assuming both classes are in the same project, that shouldn't be it). If you're in the Web Site project (e.g. developing directly in the DNN solution), then your code won't get compiled in the traditional sense, but will be on-demand compiled by DNN. It only does that for code behind files associated with requested controls/pages (e.g. your View.ascx.vb) and code files in the App_Code folder. I would guess that your hangup is that your Vacation class' code file isn't in the App_Code folder.
It looks you are not using the Web Application Project for module development. Easiest thing to do is install module development templates (from dotnetnuke.codeplex.com download starterkit package of your dnn version).
If your module is too simple and you don't want to do that, OR you don't want to install the templates in your pc, you can do following:
If you are using a vs version that is not using WAP by default, get the installation from web.
create a new folder for your dnn module in DesktopModules directory in root
add a new WAP project in that folder.
remove web.config from that folder, go to properties and point build output director to your dnn site's bin directory (../../bin will work most of the time)
Once you are done with that, all your code will start working as expected.
Good thing about this is, all your .vb and .ascx.vb files will be compiled in a single dll that you can distribute as a package easily.
Hope this helps