Converting Silverlight application to Silverlight class library - asp.net

In my Visual Studio 2010 solution I have a Silverlight application project and a hosting ASP.NET project.
Now I have added a new Silverlight application project hosted in the same ASP.NET project. I want to convert the old Silverlight application project to a Silverlight class library project, and be able to use it from the new application project by on-demand assembly downloading.
For this I need the class library project be built every time the ASP.NET project is built and the resulting DLL be copied to the respective ClientBin folder.
So my questions are:
1) How to convert an existing Silverlight application to a Silverlight class library?
2) How to host a Silverlight class library project in a ASP.NET project, i.e. how to make the DLL file be copied to the ClientBin folder of the hosting project?
Thanks in advance.

First unload the silverligh application. Then edit the .csproj file.
Look for
<SilverlightApplication>true</SilverlightApplication>
and set it to:
<SilverlightApplication>false</SilverlightApplication>
Save, reload and that's all.

Related

Deploy ASP.NET Core Razor page to Azure App Service

I'm trying to host a ASP.NET Core RazorPages project in Azure App Service.
As an example I've created a new project and that's the app I want to publish.
At first: the publish function from VS2019 (CE) failed with an exception. It is a common exception and I'm not investigate more time in in.
So I thought: I publish it using the portal. So i have a Free account of Azure, create a Resource Group, a Hosting Plan and a Web App. Then i've upload my website using OneDrive and that works.
I've add the ASP.NET Core 3.1 (x86) Runtime to the extensions and the stack is .NET Core (32 bit, because of free plan). I've build the app also for x86.
But the application doesn't work. When I add a default Index.html to the application it works (but not the Razor Pages).
Who can solve this problem??
Regards
Donovan
Looks like you copied too many files to your App Service. The bin/debug and/or bin/release folders should not be there. You need to prepare the website for deployment. In Visual Studio, you can do so by doing a right-click on the ASP.NET project and selecting 'Publish'. On the page that opens, configure a local publish to a folder. The contents of that folder should then be copied to the App Service.
For more information, see Deploy an app to a local folder using Visual Studio.
Also interesting: Host and deploy ASP.NET Core
The dotnet publish command compiles app code and copies the files required to run the app into a publish folder. When deploying from Visual Studio, the dotnet publish step occurs automatically before the files are copied to the deployment destination.
Folder contents
The publish folder contains one or more app assembly files, dependencies, and optionally the .NET runtime.
A .NET Core app can be published as self-contained deployment or framework-dependent deployment. If the app is self-contained, the assembly files that contain the .NET runtime are included in the publish folder. If the app is framework-dependent, the .NET runtime files aren't included because the app has a reference to a version of .NET that's installed on the server. The default deployment model is framework-dependent. For more information, see .NET Core application deployment.
In addition to .exe and .dll files, the publish folder for an ASP.NET Core app typically contains configuration files, static assets, and MVC views. For more information, see ASP.NET Core directory structure.

What template to use for new website in Visual Studio 2015?

I'm confused by the myriad of options for creating a new website in Visual Studio 2015.
In particular, I don't understand the difference between
File > New... Website... ASP.NET Website (Razor v3) and
File > New... Project... ASP.NET Web Application > ASP.NET 4.6.1 Templates > MVC 4
What I'd like is a website that works well with Entity Framework and provides scaffolding to quickly create data entry forms.
It seems MVC 4 provides this, but is there something similar for Razor?
The main difference between the Web Application and the Website is that it will compile the application into a single DLL file at build time. In order to update the project it must be recompiled and the DLL file published for changes to occur.
Read more at ASP.NET Web Site or ASP.NET Web Application? and Web Application Projects versus Web Site Projects in Visual Studio

Why can't I find the Controllers folder in Visual studio 2010

I'm creating an ASP.net website, I am trying to find the controllers folder but I can't see it listed:
Here is a picture of what's listed:
http://s27.postimg.org/kjy7tjr9v/Asp_net_Images_Folder.jpg
A asp.net web forms project will not have a controllers folder. Make sure you set it up as an MVC project.
You need to convert your Web Site to a Web Application and then add the MVC components from the nuget package here:
http://www.nuget.org/packages/AspNetMvc

debugging dll in vb.net web application

I have a vb.net web application in visual web developer 2008 with a dll file and i need to debug a method in that dll.
I also have project source files for the dll file itself. How could i make the web application use the source instead of the dll file so that i'd be able to debug it?
I've tried debugging the dll project itself, but it's not a very good solution, because it seems the dll depends on the web application settings and data and it would simply be too much work to get it working.
If you have your web application running locally, open up your DLL project and then attach the debugger to IIS.

How to get the Silverlight XAP copied to the clientbin on build

I am just getting started with Silverlight and have recently added a Silverlight project to an established solution. In this particular scenario my solution included an existing ASP.NET web site (not application) which Visual Studio kindly offered to integrated my Silverlight application into, which I accepted.
So everything is fine and all, and the Silverlight XAP is being copied to the web site's ClientBin directory. Now I have decided to start a new ASP.NET MVC web application that will eventually replace the older (non-MVC) web site. But I cannot for the life of me figure out what Visual Studio modified to get the XAP to automatically appear in the web site's ClientBin on build, so that I can reproduce that on my MVC site.
So my question is essentially, what are the manually steps for getting Visual Studio to autocopy a Silverlight application's XAP to a newly added ASP.NET MVC web application?
You can do this through the properties of your web project. The Silverlight tools for visual studio add a new tab to the properties of web projects named "Silverlight Links".
Add a reference to your Silverlight project here, with the folder where you want it, and visual studio will make the copy for you.
The copying of the XAP to the ClientBin is a MSBuild task. If you're using a standard ASP.NET project template it can be found under the Silverlight Link section.
For everything else you might be able to figure out the name of the MSBuild task and add it to your ASP.NET MVC project. The easier solution would probably be to use a custom post-build event on the APS.NET project to copy the file.
There is no "magic" happening, oter than copying the XAP file from the BIN directory of your Silverlight project to the ClientBin of your web application. It doesn't even have to live inside the ClientBin directory - you can copy it to any directory, or the root of your site.
Update: The recently released Beta 1 of ASP.NET MVC includes support for Silverlight projects, so you can link it to your ASP.NET MVC application the same way you do for regular ASP.NET applications.
Go to the property pages of your Silverlight application, Choose Build Events Tab, Enter following line in Post-Build events command line:
copy $(TargetDir)*.xap $(SolutionDir)<youar web solution folder name such as app.web>\ClientBin
Now onwards, on each successful build, the xap file will be copied automatically.
This is a somewhat older post so it probably has changed... in my Visual Studio under the web project there is a tab called "Silverlight Applications". There is an add button there for existing projects that you import into the solution and you can add them and choose to place the xap in the ClientBin or anywhere else. Not sure if you have to have the SDK installed to have this tab. I have it installed so you may have to. I don't do MVC, so it may be different for MVC projects, I don't know.

Resources