How can share code/files/folders between projects in same solution using Visual Studio? - visual-studio

How can copy all files and folders in 'Folder' from 'ProjectB' to 'ProjectA'
Solution
*ProjectA*
*ProjectB*
**Folder**
SubFolder
Files.extension
SubFolder
SubFolder
Files.extension
In visual studio i have created two different project in same solution.
I use AngularJS in both of projects, i have create some mine components for management data. Also i use AngularUI routing and i include all components as dependencies.
How can create a copy link for folder 'Folder' from 'ProjectB' that can include in 'ProjectA' ?
For now, i have duplicated all files, so if any change has been place in one project that include 'Folder', i must copy/paste folder 'Folder' to other project, so both projects have same files and code.
SOLUTION
In windows you can create linked folder from command prompt with this command 'mklink /D target source'. So any change to one file will bind to other always

Related

Exclude folder and all sub folders and files in Visual Studio Web Deployment Project

In Visual Studio 2013, I am trying to exclude an entire folder from the MSI that is created. I tried to adding entries to the ExcludeFilter property of the "Content File from XXX (Active)" item but it doesn't appear to do anything.
I tried the following:
Exclude specific file: \Test\TimerWorker\1\Index.js
Exclude by wildcard: \Test\TimerWorker\1\*.*
Exclude by sub folder: \Test**\*.*
I also tried Googling for a solution and all I could find was about adding tags to the .csproj file but nothing has worked for me yet.
Edit 1:
I tried following the steps outlined in the following article but they made no difference. It looks like all I am able to do from the IDE is exclude files which are located directly under the root folder. Does anyone know how I can exclude an entire folder and all of its subfolders and files?
https://blogs.msdn.microsoft.com/webdev/2010/04/22/web-deployment-excluding-files-and-folders-via-the-web-applications-project-file/
First of all when adding files to installer project, you should add only primary output which will ensure to add only required dependencies.
:
Secondly, if any unwanted file show up in the installer project then you can simply right click and exclude, It will not be copied to destination.

Is it possible to change the basic project folder architecture?

I have created a new project called myProject1.
Now Visual studio creates in the folder where I placed the project a folder called myProject1 and there it also creates a subfolder myProject1 where it then puts the source files. Thus I have
c:\MyProjectLocation\myProject1\myProject1
Now my question hwere is: Can I change it so that the 2nd sub folder is not used and the source files put into the first folder? Thus I only get:
c:\MyProjectLocation\myProject1
As example.

How to "unignore" Visual Studio Web Site *.refresh files when you have [Bb]in/*

I'm using the standard Visual Studio .gitignore at
https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
Part of that gitignore is to ignore the bin folders, but this is a problem, because I need to include bin/*.refresh files for visual studio web site projects.
When one has a (local file) web site project in: C:\Projects\MyprojectA\MyProjectWeb then any references to libraries are stored as "hint files" in the C:\Projects\MyprojectA\MyprojectWeb\bin folder as *.refresh.
So if you reference (a non framework DLL) AjaxControlToolkit.dll, so in the bin folder, you end up with AjaxControlToolkit.dll and AjaxControlToolkit.dll.refresh. The content of the file indicates the path of where to find that DLL. (Let's ignore the potential pathing problems when the repo is cloned, because we're checking in the DLLs into a _lib folder that's also checked into the repo)
How does one "unignore" the *.refresh files found within Visual Studio Web Site project bin folders so that they are included with clones of the repo?
How about using this VS feature?:
Use the exclamation mark.
**/[Bb]in/*
!**/[Bb]in/*.refresh
Once folders are excluded they can't be un-excluded. Do it this way to include sub-folders like roslyn.
replace
[Bb]in/
with
**/[Bb]in/**/*.*
!**/[Bb]in/**/*.refresh
Tiny expansion to Alex' answer, the 'Add Ignored File' button might be hidden under the 'Git' submenu.
'Add Ignored File to Source Control' button

Visual studio compile error

I as using visual studio 2010. My solution is having more than one projects in it which are have relationships to each. When I adding a reference to a other project I can use public components (classes,enums ) of that. But when I compile it it gives error saying that those classes are not referenced(Not available).
But when I change the folder structure(When I reduce the level of folder hierarchy/when project folders borings to the root folder ex: d:\ ) it works fine.
Is it because of the length of the folder hierarchi ?
Check your namespaces
When you're adding reference, add it using Project References. So what it does is it compiles the dependencies first. Check if all projects are compiling individually.
Verify target framework versions
No, it is not because of folder hierarchy.... it is because not setting hierarchy properly !!
Follow this steps:
Lets say you have project A and project B.
Project A is dependent on Project B. So we need to add dependency of Project B to Project A.
So right click on Project A -> Open Folder in File Explorer.
Then check which folder it opens into (Lets call it "source folder") and check where the project files whose dependency to be added (Lets call it "destination folder") are located from that folder location. Add the relative path from source to destination folder. (Ex: "..\..\destination folder" ).
Add this relative path in Project A Properties -> Configuration Properties -> C/C++ ->Additional Include Directories.
Good luck.
Yes, hangar18 has suggested correctly. Add reference of each project (Static Libraries) to you execuatble project ( Console Application Project / Startup project).
Also add path of each folder where the header files and corresponding C/C++ files are residing.

What's the easiest way to install 100s of files in a Visual Studio setup project

I have a standard c# application that acts as a GUI front end for a an "R" statistics engine. "R" consists of approx 600 files in approx 50 different folders and can be "installed" on a machine through xcopy deployment.
I would like to package up both the R engine and my c# gui into one setup.exe so that the user doesn't need to go and install R first and then my c# application seperately.
I know that I can produce a setup project and then add in the R files one by one but adding all 600 files will be very tedious!
Is there an easier way of doing what I want? Can I add the single R folder and automatically add the subfolders and files to save me adding them in one by one? Or maybe do an unzip procedure in my setup project which will unzip the R engine in one go?
You can simply drag/drop the folder in Windows Explorer into the File System view of your Installer vdproj. All the files and folders in the hierarchy will be added to your setup project.
Tip: If the folders are in SVN or similar source control, delete all the hidden folders before you do this! If you have PowerShell, check out
get-childitem . -include _svn -force -recurse | foreach ($_) {remove-item -recurse -force $_.fullname}
Or you can always use Windows Search to find all hidden directories in the hierarchy and delete them from the Results Window.
I couldn't work out the project file so what I did in the end was to zip up all the files I wanted to deploy, add the zip file to the application and create a custom Installer class to unzip them (using CSharp ziplib)
I think Badjer is most of the way there.
If your 600 files are part of a project and the "Build action" for each of these is set as content you can add all of these by simply:
Going to the setup project
Selecting Add > Project Output
Selecting the project the files belong to from the drop down
Selecting the "Content Files" option from the list below
Clicking OK.
You can check the files will be added to the appropriate place by going to View > File System on the setup project and checking that the content files output is being added to the correct folder.
The files will be added to the install directory in the same hierarchy as they are specified in the project they belong to.
Have a look at the project file. I believe is text based. You might be able to insert the file paths directly there with some copy-paste-replace.
One thing you could try is adding the R files as content in the C# project - then the setup project can just copy them over for you (make sure you configure the setup file to copy content files from your project, not just the primary output).
You can either add the R folders into the project manually, or set up a script to modify the .csproj file (it's just an XML file) - content items are represented by these nodes:
<Content Include="myfile" />

Resources