Class Library project for Asp.Net deploying other files than dll - asp.net

i've made a Class Library project for Asp.Net applications, consisting in some classes plus some support js, css, and image files that need to be deployed in the hosting web application.
The problem is that the support files are copied in the bin\ directory of application, so they becomes unavailable on the iis (HTTP 403 errors), infact the bin folder is only for dll files.
Any idea on how to publish these support files to make them available to main app?
Thanks.

You need to embed your resources into your class library. Your js, css and image files will then be contained within your dll and accessible to your other projects.
Here is a walkthrough.

you should use visual studio's publish feature when deploying web applications.
Right click on the web application project and you should see the 'publish' option which enables you to publish the content files and assemblies without a hassle.

Take the js, css and image files out of the class library. The class library is just that - a project that compiles into a DLL.

Related

Include Css Intellisense from one project in another

I have multiple web apps running on a server that all use a lot of the same css/image files. In order make everything more centralized i've taken all of the files out of the projects and wrote a small static file server in asp.net core with some gulp tasks to manage the css. The goal was to have it act like a cdn (with only one machine) and serve some other api functions, but to work locally without internet access.
I figured that if i included the visual studio project in the solutions for my other projects they would have access to the css/scss files for intellisense, which was not the case.
Is there some way that i can reference the files in visual studio so that i can get auto completion in the apps' view files?
I solved this problem by creating a symbolic link that included the assets in the desired project.

Adding grunt output directory to ASP.NET web service

I am creating a javascript webApp and i deploy it using GruntJS. this web app will be deployed in an ASP.NET MVC Web Service. I want to add the dist folder (and any files created by grunt inside the folder) programmatically inside the visual studio project, so when I build and deploy the web service I can navigate to this folder. Hope I was clear!
Yes you can. Grunt is completely independent of IDEs and texteditors and is a really helpful tool for all kinds of web development in any editor.
Grunt is described as “a node based javascript task runner with which you can automate tasks like minification, compilation, unit testing, linting and more”. You can use it for example when you do not like to be dependent on an asp.net web server doing minification and bundling for you, or you simply like to be able to use tools that are not (yet) supported by the asp.net/Visual Studio ecosystem.
Here is all you need: http://joeriks.com/2013/08/06/can-i-benefit-from-grunt-for-my-visual-studio-based-web-development/
Hope this helps!
Try to tweak WebDeploy settings in your MSBuild file (*.csproj?) so it would include files from the dist folder into your web application during publishing.
The following tutorial should be a good starting point how to do it:
http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/deploying-extra-files
Also check ASP.NET Solution Template on Visual Studio Gallery

It is only able to refer the class files inside App_Code folder in a file in ASP .NET website application

Only the class files inside App_Code folder is able to refer in a file in ASP .NET website application. Why its so?
Only the class files inside App_Code folder is able to refer in a file in
ASP .NET website application. Why its so?
The answer is very simple Website application working as designed.
App_Code folder is a special ASP.NET RUNTIME folder.Any files in this folder are compiled by ASP.NET when your site is actually running on the server.
This essentially allows you to drop random class/code files in this folder to be compiled on the server side. For this very reason if you drop something new into the App_Code folder of your running web site, it is like resetting it coz ASP.NET runtime now recognizes that there is a new class which needs to be kept in consideration during running the site. This magical folder brings with itself various connotations when it comes to different project typescourtesy
ASP.NET decide at runtime which compiler to invoke for the App_Code folder based on the files it contains. If the App_Code folder contains .vb files, ASP.NET uses the VB compiler. if it contains .cs files, ASP.NET uses the C# compiler, and so on...
You can refer the following resources too.
Web Application Projects versus Web Site Projects
Shared Code Folders in ASP.NET Web Site Projects
There's a difference between ASP.NET WebSite and ASP.NET Web Application. It appears that you created a WebSite in which code files are stored the App_Code folder. If you create a web application you can place the code wherever you want an they will be compiled to assemblies that will be copied to the bin folder. This way you don't need to deploy your source code on the web server.

What is relationship between App_Licenses.dll and licx?

I am trying to understand how the licensing works in ASP.NET.
There is licx file, App_Licenses.dll file. And then there is a difference between how the licensing works for a WebSite and a WebApp project.
Any insight into these would be of great help.
Links, explanation are most welcome.
Thanks.
I'm not sure of any differences between WebSite and WebApp, but with a licx file, it is compiled into the app_Licenses.dll file. If its not generating for you - you can right click on your licx file and regenerate the dll.
As per MS -
http://connect.microsoft.com/VisualStudio/feedback/details/499908/app-license-dll-can-not-be-generated-automatically-in-asp-net-website
In a web application project, manually copy the .lic file to /bin folder. In a Website, this is done automatically.
At this pointm refresh the designer or rerun the project and the licensed control should work as expected.
Note: App_LICENSES.dll isn't required in a WAP. In Websites, App_LICENSES.dll is generated to contain the LICX as an embedded resource. In WAP, there is a project assembly which contains the embedded LICX resource, so a separate DLL is not necessary

ASP.NET files necessary for development

I am just getting started in ASP.NET and have some existing projects to maintain.
I have read that ASP.NET projects include a folder called app_data, a code behind DLL, .sln project files, .proj files etc
Which of these files are necessary for the continued development of a ASP.NET website?
Also, are there others which are key to building ASP.NET applications?
Unfortunately, there are two kinds of ASP.NET application: Web Sites and Web Application Projects. If you have files with a .csproj type or .vbproj, then you're in luck - you have a Web Application Project. You'll want to open the .csproj file as a project in Visual Studio. All the files that are listed are necessary.
In fact, if it's in the site's folder or subfolders, you should assume it's necessary.

Resources