Share files between projects in visual studio 2013? - visual-studio

I have a F# project which is compiled for .Net 4.5. However, I need it to be compiled .Net 4.0 too. I created another project target .Net 4.0 and I can copy all the same files from the .Net 4.5 project to the newly created project.
The project referred some NuGet libraries which have different packages for .Net 4.5 and 4.0 so I cannot simply change the project's .Net version and recompile. How to avoid maintain two copies of the same files? I know VS 2015 has shared files function.

try "Add As Link".
Project menu > Add Existing Item... and in the Add drop-down list, click Add As Link.

I think you would be better off using source control to share files.
The source control has one copy.
Having a multiple copies on your hard drive is actually a good thing. One project can use a stable version while another project updates and tests a new version.
The only disadvantage is if one project checks in changes, you must remember to do a 'get' for the other projects.

Related

I have no way of click a "Pack" for my project library to publish it

Can someone tell me how to do "Pack" on older project versions . I have two projects which are libraries, one shows the option "Pack" on the other I don't have this option.
Visual Studio 2019
In the end, it turns out that the Core project allows you to pack this way.
The first project was SDK and the second was not.

Is it possible to include a program project and a Wix project both in a Visual Studio Solution?

For example, I use Visual Studio to create a mono game project in the solution, and I add another wix project that
when I hit "build solution", the mono game project being build, and wix project build a installer directly afterward.
In this way, I don't need to separate my project everywhere, because I just want some more additional options with One-Click installer.
If I can use Wix, I can customize the installer, but how?
After search for some time, I found this
http://wixtoolset.org/documentation/manual/v3/votive/votive_project_references.html
But, I would like to put two projects in a same solution folder, rather than two separate solution folder. This way, if I change the path, will the link just broke up?
Yes, you can. Simply add a reference to the project from your WIX project.
Note that with project references, you can use variables in your wxs files. For example if your game project were DavidWong.MyGame:
<File Id="MyGame.exe"
Name="$(var.DavidWong.MyGame.TargetFileName)"
Source="$(var.DavidWong.MyGame.TargetPath)" KeyPath="yes" />
See the documentation for more info.
Yes, it can be done ( project reference and $(var.ProjectName.TargetDir) and so on ) but in my experience there are a few reasons not to:
1) When a new version of Visual Studio comes out you might be stuck if a new version of WiX is not yet released to support that version of Visual Studio. I've seen this several times and currently you'd have to run a beta build of WiX v3.10 if you wanted to support Visual Studio 2015.
2) All developers now have to install WiX or get error messages that some projects couldn't be loaded.
3) Some developers will complain that they don't want "setup" code in their .NET solution. I think this is a thin complaint but I kinda get it.
What I like to do is have an application solution and an installer solution. I use postbuild copy commands and MSBuild publish profiles to stage content in a "deploy" folder that models the deployed system and then use that reference that structure in my wix code.

TFS: different .NET framework projects in the same solution?

I have a TFS project that has multiple .NET 3.5 projects.
I want to create a windows phone 8 project in the same solution cause it will reference a a .NET 3.5 library project and a WCF project.
when my colleagues get the latest version from the TFS, they can't load the solution cause they don't have Visual Studio 2012 (which is used for the windows phone project).
is there a way to add my windows phone project to the TFS solution without affecting the other older framework projects ?
I suggest you to add your project normally (Add Existing project to source control), but when you chenck in, you don't check in your solution file. with this solution you save your code in repository without affecting basic behavior

How to build two version of .net framework at one click on visual studio

below is what I want:
There are several versions of .Net Framework, like 3.5 and 4.0. Is there a way on Visual Studio to click the build button and get two built .exe or .dll files?
I know there is "Batch Build" in Visual Studio to build several .exe at the same time, but I can create different build configurations. But I cannot assign different build configuration with different .Net Framework version and get the build result at the same time. Did I miss something or is there any work around?
Thanks a lot.
To do this you should have one Major project that develop on one it. its version is 3.5
create another project and add first project files to it. after build the solution you have two version of compilation from your code.
to have a clean work you can use Post-Build event to copy output files to another directory.
ask me if any point is not clear

Where shall I put the assemblies related to tools I use in all my Visual Studio projects?

When I develop my web applications in Visual Studio 2010 I use tools such as GhostDoc, SandCastle, AJAX Toolkit, Moq, etc...
I usually use these tools in all my projects. When I downloaded the Moq tool for instance, I had a zip file with inside a couple of assemblies. Therefore, after unzipping the file, I added the relevant assemblies within the folder (in the file system) of the project I was currently developing, and then I referenced the dlls from Visual Studio.
Now the problem, or better organizational drawbacks, with this are 2:
1) I placed the assemblies within a specific project folder. That's ugly, since I would like to put the assemblies in one folder common to all the projects. Where do you usually put them?
2) Everytime I start a new project I need to reference all the assemblies over again. This, especially with the Ajax Toolkit is quite annoying. Is there any way to tell Visual Studio to add a set of predefined assemblies everytime I create a new project?
For the popular tools you can use NuGet. It will help you manage both the downloading, updating and removal of tools and referencing the appropriate assemblies.
Of the ones you mention, I found the following ones in the official NuGet packages repo:
Moq
AjaxControlToolkit

Resources