WP7 app could not start for debugging - visual-studio-2010

I have to create around 200 WP7 apps that are very similar. They differ only in the content, icons and name. So manually create them isn't a good idea so let's I've written a little tool, which does the following:
Copy the created template project
Copy the content files from a source directory to the copied template.
Change the app name, tile name and app id in the WMAppManifest.xml
Add the copied content files in the .csproj-file.
This works and the generated project opens error-free in Visual Studio 2010 and compiles without errors. The xap-file can be deployed on device and emulator.
The problems:
If I want to debug the app by pressing F5 in Visual Studio I get "The application could not be launched for debugging. Ensure that the target device screen is unlocked and that application is installed", both for device (which is unlocked and connected with Zune/WPConnect) and the emulator.
If I try to start the app on the emulator it closes immediatle after start. BUT if I start the app on my device it works like a charm. Crazy stuff.
The curious stuff: If I do the things which my little tool does manuelly I can debug the project from Visual Studio.
This only occures with my generated projects. Every other WP7 project (existing or newly created within VS) works and debugs error-free.
I tried to PCs: Win7 x64 with VS2010 Ultimate and an other one Win7 x64/VS2010 Pro and on both maschines I have the problem.
Maybe someone has an idea which causes the problem. Thanks for the help!
Edit: I've seen something new: The AssemblyInfo.cs file is located in the properties folder and correctly included in the csproj-file. But if I try to open the Assembly Information from the project properties all fields are empty and if I try to set them I get an error ("value is not in the expected range" or something like this).

I've got similar problem with some sample programs.
It turned out that I have to set in a Solution properties:
Active config => Debug|Windows Phone
it works for me

If they only differ in content, icons, and name, would it be simpler to make one complete app, copy it 199 times, and then just put the appropriate files into the correct directories?(if you made a tool to make templated projects, i'm sure you could do this with code too)
Plus that way if you ever need to change the program you can just recopy with that code again, but not copy the content, thus updating all of your individual 200 apps.

Related

Remove Temporary key C# Windows 8 App

How do I Remove a Temporary key in a C# Windows 8 App? I downloaded a template that has one and got the error it expired. Do I need to put in a key of my own? I'm sure the author wont care its just the C# Windows Store Grid App XAML) Template that visual studios ultimate 2013 provides. The author just added a background image to show people how to do that. I removed his image and put in my own.
I'm a total noob at coding this is my first time using visual studios. All I understand atm is web design and adding snippets and changing values of code as well as compiling it.
I like to open, open source code to learn from it and see how it works.
Within your solution, double-click on the "Package.appxmanifest" file. This should open up the "App Manifest Designer". Go to the Packaging tab. Click on the button labeled "Choose Certificate..." and choose a new certificate. Chances are you want "Create test certificate...". You don't need a password. Hit OK and you should be good to go.
If you're looking to sideload the app onto other machines at your workplace or upload the app to the app store, you've got quite a bit of other work to do -- but that is I think outside the scope of this question.

phonegap windows phone copy existing www over?

I have created a phonegap windows phone project, did the install and setup. It runs fine with the demo/default code when I run the emulator.
I have an existing android project. I drag my www folder to the windows project and nothing works.
The manifestprocessor.js does not build any of the new files in the xml. When I right click my new files I do not have an option to select a build action. I do not get any errors on the build. I want to also note that my default htnl file should load login.html (I updated the CordovaView.xaml.cs file) and the cordova.js files is inside the "js" folder in www, not on the root like the default setup.
Anyone have any ideas? I have never developed using visual studio, I am guessing I need to get my new files to be recognize so I can assign build actions I guess but since it won't let me I am not sure what to do, or even if that is the problem.
Thanks for your time and suggestions.

How should I add images using PhoneGap and Windows Phone 7?

I am new to using PhoneGap for windows phone 7.
I'm not entirely sure what the problem is - when I try to add an existing image, it's not added to the CordovaSourceDictionary.xml file, but if I manually add the image to CordovaSourceDictionary.xml, it is deleted when I build. How should I fix this problem?
Here is a tutorial by Daniel Egan. Also I have some other links for you
Tutorial: how to create HTML5 applications on Windows Phone thanks to PhoneGap.
Getting Started with Windows Phone.
Getting Started with Windows 8.
Apache Cordova Documentation.
Hope this will help you.
Check image Build Action property (Solution explorer, item Properties view). It must be set to Content, (when you add image, by default this property value is Resource)
CordovaSourceDictionary.xml is updated by the build process which relies on the way Visual Studio works. You need to trigger a file update, you know, like Right click on the Solution > Add > Add new folder / Existing item etc.
What I do is drag the file from Windows Explorer into the Visual Studio project and drop it in the images folder. NOW Visual Studio knows you have add a new file and when you run the project CordovaSourceDictionary.xml gets automagically updated with your changes.
Keep up the good fight!
This probably isn't what is breaking your system, but the JS framework I use adds a url query to each image when in a debugging mode (in order to force browsers to reload image, instead of using cached). So, my image "image/background.jpg" would be accessed as "image/background.jpg?d=34342233". But, when running on phoneGAP for Windows Phone, it won't recognize the image, and thus it shows up as broken. So, I had to turn off debugging for the framework I use, and suddenly the images showed up. Don't forget to set the Build Action to "Content" as mentioned earlier.

Visual Studio 2010 Designer Bug: Unable to copy from obj\debug to bin\debug

Wondering if anyone has a solution to this 2010 bug. I have a project that built fine in Visual Studio 2008 that wont build in 2010 because Visual Studio is holding on to the dll after the application is run ONLY if a designer window is open. I created a really light weight project that shows this problem. If you create an application then create a lib dll. Put one form in the dll, open the form in design view and then run the application. It will run fine, then close the app, go to the code view of the form in design view, and change the code ( I just renamed a single variable) then try to recompile you get the following:
Error 1 Unable to copy file "obj\Debug\customlib.dll" to "build\debug\customlib.dll". The process cannot access the file 'build\debug\Customlib.dll' because it is being used by another process.
If you run Process Explorer and search for the dll, the only process holding the dll is devenv.exe!!!
I have done a ton of searching on this problem and have found similar issues with older versions of Dev Studio where people were able to just add a pre-step to move the locked dll to another name (.locked) and build. Well that works the first time, but the next time you run then edit you are locked out of both the current dll and the one you moved to .locked, so unless I am willing to add code to randomly generate a name for the locked dll, this wont work for me (I don't want my debug directory size to grow with files never getting deleted.)
I have only found one workaround and if you are in this same boat this is what I have to do to edit and run. I make sure EVERY design view window is closed BEFORE I ever run my project in the debugger. If you close all the open design view windows devenv.exe will not hold the dll.
Does anyone have a better solution to this problem?
I'm not sure whether this will work for you or not, but this similar question if you have this line in AssemblyInfo.cs:
[assembly: AssemblyVersion("2.0.*")]
changing it to:
[assembly: AssemblyVersion("2.0.0.0")]
will solve this isue.
The Visual Studio add-on "VSCommands" claims to have a fix for this problem. I've not tested it yet, but it also claims to have an in-IDE stackoverflow reputation tracker which intrigues me :)
Your "Close designer before debugging" workaround seems to be working for me (so far), for which I'm very grateful. It was beginning to get to the stage where am large part of my day was spent in the following workflow...
F5
loud expletive
ALT F4
WIN 3
waits impatiently...
F5
I have had the same problems for a long time and then suddenly they disappeared. I realized that the source of the problems was initializing code in the constructors of WCF services and WPF controls. After cleaning the constructors from any dependencies to other assemblies everything has been fine.
So my suggestion is: Clean your constructors.
In WPF it is possible that inserting:
if (DesignerProperties.GetIsInDesignMode(this)) return;
or similar will have the same effect.

How to develop a VS2010 Silverlight Business Application without it caching the .xap file?

In Visual Studio 2010 I've created a Silverlight app by choosing the "Silverlight Business Application" template.
I changed some code in Home.xaml.cs, closed Visual Studio, opened it again, and began making more changes.
But now the changes that I make to the code don't take effect at all. It's as if the entire application is cached. I can even delete the whole contents of the Home.xaml.cs file so it is blank, and pressing F5 shows me my original Silverlight app. This happens both in Firefox and Chrome. I've rebuilt, deleted the bin directory, but it keeps showing me the same old application.
What do I need to change in this template so that I can make changes to the code, and see them reflected in the application?
Addendum:
I created a new Silverlight Business App, copied all the code to it, and this caches after the first change as well.
So it occurred to me to go into BusinessApplicationTestPage.asp and chang the link to the .xap file:
<param name="source" value="ClientBin/BusinessApplication4.xap?id=111"/>
So i've "fixed" the problem in that I change the id each time I run the application. And I suppose I could put a random number generator in here so that it refreshes each time. But... is this the intent? Isn't there an easier way to develop without this caching, and then only when deploying to cache like this?
Update:
Ok, just by adding that ?id=111 once, it recognizes each change now. Perhaps...
Start by using Control-F5 in IE. This not only refreshes the page, it clears the browser cache so in theory you will download a new version.
If weirdness like this is still happening you need to delete the contents of these folders...
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
This is such a well known pain-point in older versions of Visual Studio that most web developers I know have batch files specifically for cleaning out those directories.
These folders exist so that you can alter ASP.NET applications while the application is still running. IIS will detect the changed files and copy them to the temp directory while it silently restarts your web site. Alas this doesn't always work correctly, especially when running under the IDE.
I know this isn't an ideal solution, but I have found that the IE9 Beta caches XAPs much less aggressively than other browsers, and I don't face this problem when running my Silverlight applications in it.

Resources