Visual Studio wont allow copy & paste from one project to another - visual-studio

I have updated to version 17.3.1 of Visual Studio a few weeks ago and just tried to create a windows forms project which is very similar to an existing windows forms project. I wanted to copy the controls from the existing project into the new project but found that when I copy the control (using copy or Ctrl-C) and move to the new project and attempt to paste the paste option is "greyed" out or disabled. Has something changed where I need to enable pasting.
Your help is appreciated.
Brad

Related

Add existing files to visual studio project

I have a straightorward console application that I build using code::blocks. A client has requested a microsoft visual studio project to build it. So I downloaded and installed visual studio and created a project. Now I am trying to add my source files to the project.
Various online help pages say "Select project; select menu item "Add Existing Item" ( e.g. https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/9f4t9t92(v=vs.100). I cannot find "add existing item"! Add new item simply adds an empty file.
I tried dragging files from windows explorer onto the project, but this REMOVES the file from where it belongs - NOT what I want to happen.
Surely there must be a way to do this! Even without using alternative IDEs, different projects frequently must share common source code, so source files from one project need to be added to another.
The answer is to use File | New | Project from Existing code rather than simple 'New Project' when creating the project

Create Visual Studio Solution from Batch File

Visual Studio seems to consist of a single solution file (*.sln) along with one or more project files (a C# project would have the *.csproj extension).
I have been playing around with a console application that parses existing directory entries to create solution files with the associated project files.
It works, but every time I run into a new project here at work I find myself spending a week or more debugging my console project so that it can churn out a solution for that particular work project.
Is there something out there already that can create a VS solution out of an existing file structure?
As you can tell from my screen capture below, these projects are nested very deep, so it would take a very long time to do this with the apps folder below with the "by mouse" technique in the Visual Studio IDE.
I created the custom console application that is posted in this post:
https://stackoverflow.com/a/22153536/153923
I invite others to contribute how they approached this solution, though.
So, I found out today that this feature already exists in Visual Studio.
Link 1: How to: Create a Project from Existing Code Files
Link 2: How to: Create a Project from Existing Code Files
Basically, though, it says this (just in case the MSDN links get changed or deleted):
You can create a Visual Studio project from an existing app—for example, an app that you obtained from an online source. Project and solution files are created on your computer and the other relevant files are added. A project can be created from Visual C++, Visual Basic, or Visual C# code files.
Security note Security Note
We recommend that you determine the trustworthiness of existing code files before you import them into Visual Studio, because Visual Studio will execute some of the code in a fully trusted process when you open the newly created project.
To create a project from existing code files
On the menu bar, choose File, New, Project From Existing Code.
The Create New Project from Existing Code Files wizard opens.
Use the wizard to specify the details of the existing code files that will be added to the project and the application that will be created when you build the project.
Another good answer was given by cbp in Visual Studio: Create a web application from existing code:
--
OK I figured it out. It's weird, but the following steps will work:
Open fresh copy of Visual Studio
File->New Project, select Web Application
Use the following settings:
Name: Website (this is the name of the existing folder with the website files in it)
Location: C:\Temp\ (anywhere will do for now)
Solution Name: TheProject (name of the existing project's root folder)
Check "Create directory for solution"
Delete the auto-created Default, Global and Web.config files
Save All and close Visual Studio
In Windows Explorer, copy the new folder on top of the existing folder so that the files are merged.
Double click on the sln file to open Visual Studio again.
Select "Show all files" (at the top of Solution Explorer)
Right click on any files or folders you want to add and select Include in Project.
Great idea!

Running new MonoGame project with Xamarin Studio

I am trying to start a new project for mac using MonoGame. I have installed everything I believe is required but when I run the new project (mono game logo should pop up) I get these two lines in the output:
Loaded assembly: /Users/Kristin/Projects/Test/Test/bin/Debug/Test.app/Contents/MonoBundle/Test.exe
Loaded assembly: /Users/Kristin/Projects/Test/Test/bin/Debug/Test.app/Contents/MonoBundle/MonoMac.dll [External]
and the new application that is started hangs without popping up a window. I tried following the steps on this page: http://jamie.ly/wordpress/programming/software/setting-up-a-monogame-mac-application-with-xamarin-studio/
but nothing seems to be solving my problem. Any ideas?
I know its late but I just joint monogame and found the solution:
To make it work follow the following steps:
Install the latest xamarin studio from http://xamarin.com/studio
Next download the monogame files from https://monogame.codeplex.com/releases/view/102870
choose the xamarin version on mac
Next install the templates by opening xamarin studio. Next click on the top Mac menu "Xamarin Studio" Addin Manger and choose install from file and select your donwloaded file...
so far so good but your png files will not be loaded from here... so solve this issue follow the next steps:
visit the git page from monogame and download it: https://github.com/mono/MonoGame
after Downloading and unpacking the zip file go into the folder and look open the following file by using xamarin studio
MonoGame.Framework.MacOS.sln
Now Xamarin studio should open up and include 2 Projects: Lidgren. ... and Monogame.Framework.MacOS
on the top of Xamarin studio (besides the play button you should see Debug click on it and change it to Release
now do a right click on the Monogame.Framework.MacOS project and build it new
This should be done without any errors but you may get warnings... we do not pay attention on them :D
next do you need to go again to the downloaded Monogame folder from where you opened the MonoGame.Framework.MacOS.sln project.
But this time you need to dive more deep into the folder structure: look for the following folder --> MonoGame.Framework/bin/MacOS/Release
the files in the release folder are now your new libraries...
You can copy this libraries where ever you want but you should know where they are because you need to add them to your new monogame project.
Next open up Xamarin studio and create a new Monogame project by using the already installed templates...
Choose the Monogame Mac Application Template
We are now almost done:
Look for the reference "folder in the project tree inside of Xamarin studio" and do a right click on Monogame to delete the reference...
Now you need to add new references by right click on reference.
Access the .Net-Assemblies and add your files from the MonoGame.Framework/bin/MacOS/Release/- folder (make sure that you add all of them)
The final step now is to expand your Content folder in Xamarin studio and do a left click on the logo.png file.
on the left side of the IDE you can find Properties. In the properties change 3rd from top to content instead of none.
If you run now the template the graphic should be loaded without any problems :D
I TESTED IT ON SEVERAL MACHINES IT WORKS THAT WAY!!!!
ENJOY
regards
Schreda

Copying from existing project

I have some problem in visual studio.Ok here is the scenario
first i add an existing project to my project in visual studio,and after that i tried to compile and run and it works properly...and then i exit the visual studio. and copy the folder or the visual studio solutions into my laptop.after that i open the visual solutions in my laptop after the visual studio loads,the project that i add before is greyed out and empty...can you help me on this please how can i see back my project that i add before.
When you add an existing project to a solution, you're adding a link. You didn't copy the actual project, you just copied the link, which shows as empty on your laptop.
Right-click on the project and look at the properties, you should see the location. This should show you the problem.
You won't be able to recover that project without going back to the source, you don't have the code on your laptop.
-t.
Do you copy the project off your portable drive to your hardrive? Sometimes copying it off external drives has solved that issue for me.

copying the visual studio settings for one project to another

I have a visual studio 2010 project done in VB.net and i have around 45 variables in the application settings. The one you set in the properties.settings. Now i m having a similar project and i wanna copy the settings variables to this project. Not sure how to proceed with this.
what i did is tried to copy the auto generated code for the settings into that project and it didnt work out well. I am not even sure how to google this out and tried the following.
copying application settings from one project to another in visual studio
moving application settings between visual studio projects
Both of this didnt get what i wanted and am actually out of clue on what to search for this.
So is there a way to directly copy the settings from one project to another project.
All I did was grab the physical Settings.Designer.vb and Settings.settings files found in the "My Project" folder of your applicaton (assuming it's a windows App and not web) and copied/replaced the existing settings files in the new project.
Did a rebuild of new project and errors kicked back but that was just the desinger code referencing the old project name. Corrected by replacing the old project name with the new one and voila, worked.
HTH
Dave

Resources