Visual Studio Project Linker: is it possible to populate destination project automatically? - silverlight

I have a Silverlight project with lots of source files. Now I want to create a new WP7 project using the same source code files (but obviously, target WP7).
I link the WP7 project to the existing Silverlight project using Project Linker. However, this does not automatically generate links to the existing files in the source project.
Is there any way using Project Linker to automatically populate the destination project with the already existing files in the source project? Or do I manually have to add links in the WP7 project to all previously existing files in the source project?

I have the same problem, but I resolved it.
Simply exclude all files from "source" project and then re-include them.
In this way project linker refresh its references adding all links!
It worked for me!

I'm not quite sure what you but I think you'll have to do manually in VS.Net, but if all the files in the same directory you can add all the files in one go, it sounds as though you want to select the 'Add as Link' option once the add 'Existing items' dialog is displayed.

Related

Using a common project in several other projects in visual studio

I am working on a multi-solution project on VS 2013 in C (I must use C for this project). I implemented one "Common" project that I intended to use as a reference in another project. So I have one solution with a common.h and a matching common.c source in which I implemented all the common functions.
I now created a new "Application" project (inside the current one, so I now have 2 solutions) which does many things, and use the functions that are already implemented in the common.c file (that is in the "Common" solution). So I have a app.h file with a matching app.c source. I changed the settings so that the "Application" project will include the "Common" project.
However, when I run the "Application" solution (only it since the "Common" project is only used as a reference without a main function) I receive an error telling me that there is no reference to the functions in common.h.
I looked online for a solution and someone said that I should just copy the common.c to my "Application" project, however this is a very bad solution for me since I want to have multiple applications that all of them use the "Common" project.
How can I solve it?
You shouldn't have to copy any files to make this work. Right-click on your solution at the top of the Solution Explorer window. Choose Add -> Existing Project from the context menu. Find the project file for your "Common" project. It should show up in the list of projects for your solution.
Right-click your "Application" project in the solution explorer and choose "Properties" from the context menu. In the property pages window, go to "Common Properties". Click the "Add New Reference..." button. In the "Add Reference" window, go to the "Solution" tab, and then click the checkbox for your "Common" project. Click "Ok".
Now your "Application" project has a reference to your "Common" project. You can also open common.c and common.h from inside your new solution, and any changes will automatically be applied to all other solutions that reference it, because they are the original files and not mere copies.
The above method assumes that the output of your Common project is a DLL. Visual Studio (for whatever reason) won't automatically copy statically linked library (.lib) files. You can of course link against them, but adding a reference won't work. You will need to go to the properties page for your "Application" project, go to the linker -> input tab, and edit the Additional Dependencies line. You can also add the directory containing common.h to your Additional Include Directories under the C/C++ tab.
Either way, my opinion is that merely copying the files is a bad idea unless you're using modules in source control (e.g. Git modules or SVN externals) to manage dependencies.

WPF publish application files

I am trying to publish a WPF application using the publish section in the project properties. When I attempt to specify application files (i.e. references) for the publish, I see lots of old dlls that were once in the project but were deleted later.
Is there a way to clean up this list so that it matches the references actually used in the project ?
It is not possible without extensions. However you can check this question for more details. There are also some extensions listed you could use.

A better approach to adding DLLs in VB.NET projects

I want to use a DLL written in C in a VB project such that the DLL will be copied to the output directory.
I earlier asked this question here and got an excellent answer:
VB.Net using C DLL
All you have to do is go to the Project menu and "Add Existing Item". This works great if you copy any updates to your DLL into the project folder. Now I have a new project, and I put my C project folder inside the Visual Basic project folder in hopes that Visual Basic would fetch the DLL from that folder and copy it to the output directory. Oh no, they would never make it that easy. Adding an existing item copies that file to the project folder. So now it always fetches an old copy of the DLL unless I manually fix this, which I do not want to. How can I make Visual Basic honor my wishes?
When you do the "Add Existing Item..." the Add button has two options, one that will add a Link to an existing file and not copy to your project, but it will copy to the build output.

What are the uses of a "Empty Project"

I am using VS2010, When you create a new project, you can choose from ConsoleApplication, WindowsFormsApplication, WindowsService, etc. There's also Empty Project.
The empty project contains a reference folder without any references. What is the use of this Empty Project? Is it use for any test?
The “empty project” is used when you wish to create a project that does not have any files or reference automatically added to it.
Sometimes visual studio concept of being helpful is not what you want, and you just wish to be able to define a project to include only what you decide to put in it. This is not directly related to using a project for tests, but may be helpful when you are using a test framework that is not supported by any of the project templates.

clickonce file missing

Using Clickonce with VS 2010 and .NET framework Client profile 3.5, I have several file folders with application level XML and/or textfiles that are needed at runtime.
The file folders sits in the same project where they are to be used.
These files are marked as "Copy always" at compile.
Build Action is "Content".
On my development machine the files are actually copied into the ./Bin/Release/myFileFolder/xxxxx and all is fine.
On user's computer, install runs fine but some files are reported missing at runtime when the program need them.
Do I miss something? Is any file specific option deep hidden in the option list?
Help please! and .NET framework 3.5
If the files are in referenced projects then they are not included in the click once publish by Visual Studio. You can verify this by checking the application files dialog in the publish page of the project properties.
Assuming this is the case to get these files included you can either add them as links in the main project itself or edit the project file to include extra files in the manifest. See ClickOnce Content Files for information on how to do this.
I can confirm that this can still be an issue in Visual Studio 2019.
I have been working on DevExpress dashboards that consume XML files at runtime to produce their dashboard layouts, and whenever I would publish my project, I would get a bizarre error about the XML file not being found when clearly it was published to the same output directory as the rest of the project.
Just to be clear, the XML file existed in my Visual Studio project and was set to Build Action = Content and Copy Always To Output Directory.
What I had to do was what was suggested in this answer:
Go to Project Settings.
Open the Application Files list.
Change the Publish Status of the XML file - which Visual Studio automatically set to Data File (Auto) - to Include.
Voila. FileNotFound error magically disappeared after publishing the project.
A workaround is to make your application create the xml/txt files if they dont exist.

Resources