Run Silverlight Project...doesn't point to web project - visual-studio

I've created a Silverlight app and VS set up a web app for testing automatically. Worked great - whenever I hit "run" it pointed a browser to the web app page which hosted the Silverlight app.
I've done some renaming of the projects, namespaces, files, etc. - just some general clean up. Now when I press "run" on my Silverlight app, it starts up a browser that points to the Silverlight app on disk, rather than pointing it to the test web project that VS set up automatically for me. I've dinked around inside the project settings and can't figure out how to fix this. How do I get it so that when I click "run" on my Silverlight app, the browser is pointed to the web application which references the Silverlight app?

Sounds like this is caused by the StartUp Project for your solution being set to the Silverlight application itself, rather than the Web project.
To fix this, right-click on the Web app in Solution Explorer and click on "Set as StartUp Project".
Also, right-click on your *.aspx or *.html file within your Web project and click "Set As Start Page".
Hope this helps!

Just in case this helps anyone:
I encountered the same problem, and the above method unfortunately didn't work for me.
Here's what I did: I unchecked 'Generate app manifest' from the project settings, and ticking it and rebuilding solved my problem.

Related

PUBLISH button is not appearing on the Context Menu

I have been trying to deploy a web application is a .Net Framework
When I right-click on the project Solution, PUBLISH is nowhere to be found I tried Visual Studio 2017 and re-installed, checked and updated the workloads.
I check the checkbox: One-click publishing.
I gave up, I uninstalled it and installed Visual Studio 2019 same thing PUBLISH is not appearing anywhere.
I reset settings on import-export. I look everywhere on the NuGet package manager.
I am out of ideas.
Any hint would be appreciated. I will keep on digging. If ever I find a solution I will create a video because I spent several hours and my client is waiting for this application to be deployed on Godaddy Plesk. It is the first time I do this, I usually install scripts on LAMP Cpanel really easy.
This has been a nightmare for me, everywhere I see seems easy, right-click, click on Publish and create a profile or do Ftp or system files, azure.
But I can not get that blip Button PUBLISH.
Sorry, I am ranting.
You don't right click the solution itself to publish, you right click the web layer of your project and you would see the publish button
here
Ok I do not know if all the re-install and all did something but #fatihyildizhan suggested to click on the web app logo below the solution and it did the trick!

Visual Studio web project has IIS configuration warnings

One of the web application projects in my visual studio solution has a blue exclamation mark icon on it and the tool tip shows The Web project <Project.Name.Here> has IIS configuration warnings
I can't see anything in the project Properties pages, or in the web.config file. It started yesterday, and I assumed restrating VS and reloading the project may get rid of the warning, but it has not.
What is this and how do I go about resolving this issue?
Google has not been helpful this morning!
Try right clicking the solution in the Solution Explorer, the option Resolve Errors should be available.
Selecting this should show you the message behind the icon you're seeing on the project. For me, this was:
ASP.NET 4.0 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.0 in order for your site to run correctly.
If this is the message you're receiving, this MS blog post may help you fix it.
Update
Note that once you've selected this option, the IDE assumes you've resolved the errors and removes the icon and menu option (!). So make sure you read it or restart VS to see it again.

Debugging a Silverlight project with a WCF service

I have a WCF service hosted in IIS which is consumed by a Silverlight client application. When I run the Silverlight application, none of the break points seem to get hit (not breakpoints in the service, although they also don't get hit. That service is not in the same solution).
Normally when I've created SL projects in the past, they hit break points by default, and I can't thing I've changed any of the settings.
When I run the project, I do get a message box saying, "The Silverlight project you are about to debug uses web services. Calls to the web service will fail unless the Silverlight project is hosted in and launched from the same web project as the web services. Do you want to debug anyway?"
So I say 'yes'.
My break point is in a place that I know gets hit (InitializeComponent in MainPage.xaml.cs), so that's not it.
I don't know if it makes a difference to the client application, but the WCF service does have within its App.config the compilation debug set to 'true'.
Can anyone help?
Edit:
Some useful points: The project is set to debug. There is no web component to the SL project. The application compiles and runs normally. The code in the screen shot below is the code behind for the main page which is the default page (and the one I see when I start the project). The Visual Studio version is 2010 Ultimate (version 10.0.40219.1 SPRel) and I am not creating an OOB application. As well as just running regularly, I have specifically started from the Debug->Start Debugging option in Visual Studio.
Screen shot:
If that image isn't clear enough, there is the full resolution one here.
Second screen shot showing a break point on the InitializeComponent in MainPage.xaml.cs which doesn't fire (the previous one showed the constructor of the related view model).
Again, if that's not clear enough, the full resolution version is here.
The message your getting is unrelated to your breakpoints not being hit. This 'warning' isn't entirely true as well, as long a the webservice you're calling is running you'll be fine. You can happily ignore this warning.
As to not hitting breakpoints, I can think of two reasons. You could be building in release mode, or you could be starting the wrong project. You should not be starting the MyApp.Web project Visual Studio probably created for you, but the actual Silverlight project.
If it isn't one of those options you should provide a bit more detail about what you're doing, like Visual Studio versions, whether you're running an out-of-browser app, does the app actually work etc. There can be a few more things to check but it hard to guess it them with this little info.
I'm not seeing a test page.htm in your solution. How are you hosting / running the SL app?
If you were hosting it in an ASP.NET web app I'd say check that the Silverlight debugger was enabled on the web project project properties.
But as it is I can't see how the silverlight app is getting run at all...?

Can't attach to Silverlight application with VS2010

Few days ago all was ok: when I started my web-site with Silverlight 4.0 application with F5 in Visual Studio debugger was connecting to Silverlight automatically, but now it doesn't.
I've tried to attach manually from "Debug"->"Attach to process" with "Attach to" option set into "Silverlight code" value. But my breakpoints are still "disabled"...
Why? How can I resolve that?
Thanks.
P.S. I've created new Silverlight project recently - and is been able to attach to silverlight without any problems...
check the debugger settings in the ASP project that is hosting your silverlight application, make sure silverlight is checked. Go to Properties->Web tab->Debuggers, check Silverlight
My xap-file of the Silverlight app is not being updated after compilation: I've added another control - it didn't appear in my app...
The reason: Silverlight app contained wrong "Startup Object". After fix - problem was resolved.
P.S. Sorry for stupid question.
Deleting the *.xap file solved it for me. I guess I'll have to delete it often.
One problem I see often is that the browser is caching the XAP so the changes are not seen. Deleting the XAP doesn't always fix this, one easy solution to this is to add a unique number to the xap reference in the HTML/ASPX file and just increment it when you want to force a reload (e.g here I user ver param):

How to make Visual Studio 2008 to load dynamically generated testpage from http://localhost/

I'm developing a small web application using Microsoft Silverlight 3. I'm using Microsoft Expressin Blend 3 for UI development and Visual Studio 2008 for "code-behind". When debugging the project from Blen 3, it all works well. The Silverlight is automatically embedded into an TestPage and loaded from
http://localhost/TestPage.html
However, when starting the debugger from Visual Studio 2008, the silverlight app is automatically embedded in a TestPage.html, but know loaded from file:// , as in:
file:///C:/Documents%20and%20Settings/JadaJada/My%20Documents/Expression/Blend%203/Projects/JadaJada/JadaJada/Bin/Debug/TestPage.html
And as a result, the application does not work (which might be because the app makes a few HTTP requests to http://localhost/ using a WebClient).
Do anyone know how to make Visual Studio load the TestPage.html from http://localhost/ instead of file:///C:/JadaJada/ ?
Thankful for any help!
IN VS...
Try right click web site and select property pages.
Then select start options tab
Then pick start url and enter the url you require
Solved by adding an ASP.NET Web Application project project to my silverlight solution. Then by going into the properties of my new ASP.NET Web Application project and then going to the Silverlight Applications tab and adding my Silverlight app to this project. Then I choose the TestPage.aspx in solution explorer and then start debugging. It worked!
So the steps:
Add a ASP.NET Web Application project to your Silverlight application solution.
Go into the properties of your new project.
Go to the Silverlight Applications tab.
Add you Silverlight project.
Select the TestPage.aspx and hit Start debug (F5).
That should do it.

Resources