This might be a bit tricky setup but...
I have this Silverlight project that builds into a XAP, which is all fine.
Next we have this set of class libraries we add to an existing application which then unfolds into small "applications" inside the existing one.
The problem here is...
I want my XAP to be embedded into the class library as an embedded resource, but I'm looking for a solution how to do this without some half-dodgy post-build event if possible. It would be fantastic to be able to link the output of my Silverlight project to the class library and get it embedded...I guess I'm starting to ramble a bit now ;)
Short version: link Silverlight project to a Class library project as an embedded resource...is it possible, if so how?
In the required spot in the solution explorer of your class library, right click, "Add-> Existing Item", then in the file browser that pops up change the file filter to "All", browse to the ClientBin folder of your web project (or the Bin folder of your Silverlight project), select the xap file, but don't just click 'Add', instead click on the down arrow on the button and click 'Add as link'. Then go to the properties of the newly added xap file, and change its Build Action to Embedded Resource.
No dodgy post build events required :)
Related
I have an application in my project (named App_Main). And I want to package another tiny application (let's call it App_Tiny) inside the package of App_Main.
Then, as I know App_tiny's path, I can execute App_Tiny programmatically in App_Main's run-time when I need that.
How can I achieve this? How to specify and build another executable target, AND, most importantly, automatically put App_Tiny inside the package directory of App_Main?
For adding a new target it's as easy as hitting the "New Target" button in the left hand pane of your project explorer. Xcode will allow you to choose the target type (Application) when you add it.
Next you need to add FooBarTiny as a build dependancy for your main app (FooBar). Edit the Scheme for your Main Target and add the sub target as an explicit dependancy.
Now when you build FooBar; FooBarTiny will be built if it needs to be.
Next you add FooBarTiny into the "Copy Bundle Resources" phase. Hit the add button and scroll down the tree and you can find FooBarTiny in the Products folder.
To launch FooBarTiny from within your app you can use NSWorkspace.
- (NSRunningApplication *)launchApplicationAtURL:(NSURL *)url options:(NSWorkspaceLaunchOptions)options configuration:(NSDictionary *)configuration error:(NSError **)error would probably be a good start point. Check the API docs for other variants.
EXTRA FOR THE APP STORE
It's not enough to sign your main app. Any Applescripts and sub-apps (FooBarTiny) will have to be signed as well or your app will fail validation. This answer isn't about that but theres a good blog on the issue here.
(Edit for search-ability: called "File Nesting")
I'm not sure if "folding" is the correct term, but the feature I'm referring to is shown in the 1st image below, versus the 2nd one which does not have an expandable tree list node for the code behind file.
Folding:
No folding:
My questions are:
What is the correct name of this feature?
How do I set it?
Why does my Solution Explorer not have this feature enabled when I try to convert my Web Site Project to a Web Application Project?
References:
Upgrading VS 2005 Web Site Projects to be VS 2005 Web Application
Edit
Thanks Sean, but as you can see below, my Nest Related Files button does show up in this project for some reason:
Should have button shown below:
Edit:
I figured out the reason: I accidentally created a C# Web Application Project, and then added VB ASP.NET files to it.
It's called File Nesting.
When a website project is selected in Solution Explorer, the third button in the Solution Explorer toolbar is for "Nest Related Files".
A website project or project file must be selected in Solution Explorer (rather than the root Solution), for the button to appear in the toolbar. The command/tool button is not available when C++/C# projects are selected in Solution Explorer. I don't have a web app project to test but can only conclude that the command is not applicable to web app projects either.
see this related question for a possible registry hack (changing 9.0 to 8.0 in the question's reg script):
Visual Studio 2010 related file nesting
When you are not using a website project, the nesting button in the solution explorer won't appear—but you can still nest files in .NET 5.0 projects.
Here's how you do it:
Open the project's .csproj file. Visual studio can open it in its own viewer, or else you can use your favorite XML or text editor.
Locate or create an appropriate Item Group element. If there's already one that includes some of your files, put it in there for cleanliness and consistency. If there isn't, create a new one.
Create a new Content element for the file you wish to nest. This element's Include attribute should be the name of your desired file.
Add a new DependentUpon child element to your content element. This element's text value should be the name of the file you wish to nest your target file underneath.
Save the project file and Visual Studio will likely prompt you to reload the project. If you did it correctly, your target file should now be nested under your desired file.
There's shockingly few questions and answers that address this situation. The above answer didn't help me, so I figured that I would share what did for posterity.
I am a new user of MonoTouch and wondering how to add image files to a project. None of the ways described work. The MonoTouch Wiki says to right-click the project and a menu should appear allowing one to "add" new files. There is no such right-click menu that I see.
Also, someone posted a workaround where a dummy Xcode project is created using the same folder destination as the MonoTouch application and then Xcode would establish the Resources folder and allow for the import of resource files (in my case a .JPG file).
I am not even to the point of needing to attach the image file to a control using Interface Builder; I mean: I can't even get the image file into my MonoDevelop project.
I've also tried creating a Resources subfolder inside my project folder and dropping the image file in there. No luck.
Can anyone provide a thorough procedure for adding resources to a MonoTouch project? Much appreciated.
You should right-click on your project in the Solution pad:
The context-menu is there, trust me. The project is just below the solution.
After that, you have to set your image file's Build Action to Content, again by right-clicking on the image file this time:
And to use the image from your code, you type:
UIImage myImage = UIImage.FromFile("image.jpg");
And you are all set! You can create all the folders you want in the project, but NOT a folder named "Resources". You will get an error upon compilation. In MonoTouch 3.2.5 at least...
I feel like an idiot asking such a basic question but for the life of me, I can't find much on this topic.
Anyway, how does one go about making a .lib file using Visual Studio (or whatever tool)?
Let's say I have a project or work space with one .cpp file and .obj in it.
TIA, Mike
Go to Project->Properties. Under "General" set "Configuration Type" to "Static Library (.lib)". Then under "Linker" change the extension of the Output File to .lib . Then you're good to go. Remember to do these for all your configurations (Debug, Release etc.)
To create a new static library project
From the File menu, select New and then Project….
On the Project types pane, under Visual C++, select Win32.
On the Templates pane, select Win32 Console Application.
Choose a name for the project, such as MathFuncsLib, and enter it in the Name field.
Choose a name for the solution, such as StaticLibrary, and enter it in the Solution Name field.
Press OK to start the Win32 application wizard. On the Overview page of the Win32 Application Wizard dialog box, press Next.
On the Application Settings page of the Win32 Application Wizard, under Application type, select Static library.
On the Application Settings page of the Win32 Application Wizard, under Additional options, clear the Precompiled header check box.
Press Finish to create the project.
See here for more details.
Go into proprties->Configuration Properties->General->Configuration type.
There you want to choose static library (.lib).
Then you just have to build it.
look at the project properties. There will be one that says something like output type, you just choose library, as opposed to .exe.
I know I can add a icon to the Resources.resx file of a project and then reference that icon from within the code.
How do I set the icon of the entire EXE from the resources? All I see is a place to browse for another file. I want to use the current icon file that I have in my resources and not have to have a duplicate file in my project...
thanks
The way that the adding of an application icon is that you must select it from the local file system, and then it is embedded into the application at build time. As far as I know it is not possible to have it first pull from a resource file.
One solution I always use to prevent duplicate file references, is to create a solution folder such as "Project Dependencies". And then all refereces are made from that folder, so when building it pulls from the Project Dependencies folder.
This would work for resource files also, just copy them to the solution folder first and then drag them into your resource.
And for the assembly icon, just browse to the Project Dependencies folder as well.
Good Luck!