Don't See Properties Folder in VS Project - c#

I have two projects. One where I can see the properties folder within the project and the other I can't. I have right-clicked on the solution and selected properties, but I see no way to add the folder.
I have tried (within Windows), going to the folder of my project and adding the folder that way, but I still need a way to associate the project properties with that folder I have added.
I've seen this thread. It says the folder is created by default when you create a project and if I delete them, I'll have to recreate it. I've never seen the folder on any of my projects, except one and I didn't delete it from the others, so not sure.
I attached a picture of what I am referring to in my project that actually has it if that would help. Thanks.

You need not just add folder in windows explorer, but also include it in Project (with 'Show all files' option, find this folder under project and 'Include in project' from rigth click menu).
OR, just create it from within VS (right click on Project -> Add -> New folder, and name it 'Properties')

Related

How to create global file for all projects in visual studio?

I have the file Pathes.cs(in the screenshot);
The file is not in any project. The other projects does not see it. My task is to do that file visible for all projects.
I tryed to use using Homework, to use Homework.Pathes.pathToDataDirectory in my projects.
But nothing helps.
You have a few options:
Create a Class Library project, put the file in there and reference that project in all other projects that need that class. Right-click on Dependencies in the Solution Explorer, go to Projects and select the shared class library project. This is the preferred option.
Link the file to the projects that need the file. Right-click on the project, click Add > Existing Item and navigate to the file. Instead of clicking the Add button, click on the arrow next to it and select Add As Link.
Copy-paste the file into the projects. This is a total maintenance nightmare, so don't go there.

Visual Studio 2017 can't find folder that exists in the solution

I have Visual Studio 2017 project in which I need to open a folder named Devdog.General, which is also included in my Solution. However, it won't recognize it as an existing folder and gives me a missing directory / namespace error when I try to import it. See screenshot for more info.
Try this button:
I had a similar problem the other day and it had to do with files that Visual Studio didn't know were part of the project because they'd been created externally (and that included folders). Visual Studio could see them but it was hiding them from me.
After clicking that button, you will be able to right click on the folder and select "include in project" which will include the files for compilation and navigation.
First, try selecting any of your "*.cs" files inside this "General" folder and check in the "Properties" view if the Build Action is configured to Compile. Visual Studio will only compile your file if it has the correct build action.
Secondly, open that "*.cs" file and verify if the namespace defined inside it is correct. For C#, folder structures don't matter much: what really matters is the namespace you have defined your classes in. You can define your classes in namespaces completely different than the folder they are included in your project. That is completely arbitrary, and up to your organizational needs.
An image illustrating what you need to check (and where) follows.
Things to Check
1.) Check the namespaces inside .CS files - they collectively create usable namespaces you are referencing - not folder names. If you create a few files, then move them to a folder, and create newer files inside that folder they will have different namespaces. The newer files will have the default Namespace value followed by .FolderName. So be sure to check that out.
2.) CSPROJs can get hosed and lose reference to folders that display in the UI. Remove the folder from the project (through the VS2017 UI, right click and choose that option). DO NOT DELETE. Then recreate the folder in the UI (it shouldn't let you, navigate to the folder directory manually and rename the folder.OLD temporarily). Once the folder is rename, try recreating the folder. Upon success move all your CS files into the new folder from folder.OLD. After files and folders are back to where they were essentially, then in Visual Studio, "Add existing items" on your .cs files. This recreates the CSPROJ references one by one.
3.) Unload CSPROJ, right click and Edit CSPROJ to manually check all the .CS references in ItemGroups. Make sure its myfolder\myotherfolder\mycsfile.cs.
4.) Remove reference to other projects that contain namespace, and re-add them. Verifying, one by one, the namespaces begin reappearing in Intellisense as recognized.
5.) If you try the above step, close Solution, close Visual Studio, navigate to SLN folder container, and delete hidden folder .vs and then reopen everything.
What happens is sometime a folder rename or file transfer doesn't propagate to the .CSPROJ folder, a namespace then doesn't get intellisense cached, and errors galore show up.
Please check your folder name and namespace name. probably folder name and namespace did not match
enter image description here

how to create a VS2015 project inside a specific directory with a specific projectname?

Not sure how to describe my question and ok here it goes:
We already have some existing projects created and under TFS source control.
A typical project is then stored locally as:
SomeDir\SomeNameSpace.SomeName\ProjectName\
then the csproj and sln file inside that directory will be named: SomeNameSpace.SomeName.ProjectName
Now when I want to create that same setup using Visual Studio it goes horribly wrong:
I have tried all possible options on creating a project and either it creates an extra SomeNameSpace.SomeName.ProjectName folder extra under the ProjectName directory and puts the sln and csproj inside that dir or I can create a Project under the proper ProjectName dir only then the name of the sln and csproj files will be ProjectName.snl/csproj which is neither what I want.
Renaming them of course would be the logical thing to do, however, doing that causes the sln to go corrupt. When I try to reopen it will throw a Save as DevEnv.sln in my face and that is not what I want.
Edit: Of course I have renamed inside the sln and csproj file which neither led me to the solution
So how can I create a new VS2015 solution that will nicely sit under
\SomeDir\SomeNamespace.SomeName\ProjectName\ with
SomeNameSpace.SomeName.ProjectName.sln and
SomeNameSpace.SomeName.ProjectName.csproj as it's name?
What am I missing, that it seems impossible to achive this in a simple manner?
Create the Project from the New Project VS Window. The settings you need are:
Name: ProjectName
Do NOT create directory for solution
This should create the csproj and sln files in the appropriate directory.
From here, right clic on the project in Solution Explorer -> Rename -> SomeNameSpace.SomeName.ProjectName
This way, the solution reference will be updated too.
Now, rename the solution too, from Solution Explorer.
File menu, Save All. This saves both the project AND the solution.
And I think that's it.
You should in your new project window have it look like this
Please note the highlighted aria is unticked
Ok we have figured it out.
The solution as posted by A. Chiesa was almost right.
The solution, projects and namespaces need to be set.
- Rename the Solution within the "Solution Explorer" for example name it "NameSpace.SomeName.ProjectName"
- Rename the Project within the "Solution Explorer" for example also name it "NameSpace.SomeName.ProjectName"
- Go to the project properties and rename within Application the "Assembly name:" for example also name it "NameSpace.SomeName.ProjectName"
- Go to the project properties and rename within Application the "Default namespace:" for example also name it "NameSpace.SomeName.ProjectName"
Then if you are lucky, you can use Resharper to rename the namespace for all files throughout your project or you have to do it manually (depending on files count can be a very tedious job to do).
That should do it.
Thanks everyone for your input and advice.
Best regard,
Ed

Creating a project for web assets in Visual Studio 2013

I have multiple ASP.NET MVC5 projects that use several similar styles/scripts, and I think, for maintenance's sake, it'd be ideal to have a separate project in Visual Studio 2013 containing the LESS stylesheets and JavaScript files that can be shared between the two.
My setup is as follows:
Web.Project1
Web.Project2
Web.Assets //would contain LESS/JS files
Resources
Domain
Data
Any pointers?
I've been looking at adding as a link, but I'm not certain that would accomplish what I need.
I recently went through this process for a project of mine, and concluded that if your goal is simply to avoid duplication by keeping your code DRY then using linked files works great.
It's simple enough to do, but I'll write it up anyway as it might save someone some time.
Quick Summary
Create common Solution Folders containing the resources to be shared, or simply designate one of the projects to be the master.
Use "Add as Link" to add the shared resource files to each project as needed.
Add an AfterBuild task to each project file that will copy the linked files to project folders. This is only needed so that Visual Studio test/debug (F5) will work locally.
Detailed explanation follows:
Configuring Solution Folders for the Shared Resources
** Note that if you're simply going to share files directly from one project to one or more additional projects then you can skip this step.
Visual Studio solution folders do not have to reflect physical file system folders, but doing so will help preserve your sanity. So first create the folders on your local file system and copy the resource files into them. The new folders should be located under your solution folder. For example:
\MySolution
\Common
\Images
\Scripts
\Styles
Back in Visual Studio, right click on the Solution Items folder and use Add Solution Folder to replicate the new file system folders.
Next, add the files to the new solution folders by right-clicking each folder and using Add Existing Item to add the contents of the folders.
Add Shared Resources as Links
For each project that will use the shared resources, right-click the project folder and choose Add Existing Item. Browse to the common folder, select the desired files, click the drop-down arrow next to the "Add" button and choose "Add as Link".
You may get a source control warning about adding files that are outside of the project directory structure, but this can be ignored since the linked file will be under source control at its source.
Add an AfterBuild Task to Copy Files
When you publish the application to a server the linked files will copied to the project folders to which they are linked and everything works as expected. However, in the development environment the linked files do not physically reside in the project folders. So when you hit F5 to test your application in VS, the shared resources will be missing.
The simple solution is to add an MSBuild task to copy the linked files from their source after each build. This needs to be done to for each project that contains the shared resource links.
Right-click the project and choose Unload Project. Right-click the project again and choose Edit <ProjectFileName>. Scroll to the bottom and add the following (just above "</Project>"):
<Target Name="AfterBuild">
<!-- Copy linked content files to local folders so that they are available in the debugger.
This is only an issue when running the application locally. The linked files should
be automatically published to the correct folder when publishing to a web server. -->
<Copy SourceFiles="%(Content.Identity)"
DestinationFiles="%(Content.Link)"
SkipUnchangedFiles='true'
OverwriteReadOnlyFiles='true'
Condition="'%(Content.Link)' != ''" />
</Target>
** Copy task adapted from this link.
Save the project file then right-click and choose Reload Project.

How to add Readme file in visual studio web installer?

How can we add readme files in web installers created using visual studio.After installing the product,readme file's path should be shown in control panel.
You can easily add a readme by creating it and putting it in the applications contents by finding the text file within solutions explorer, right clicking and then going to properties.
In the properties change build action to content and I'm assuming you'd want copy if newer selected on copy to output folder
from here simply go into the file system of your Installer project, go to application folder then right click on a blank space in the applications folder panel, add, project output and finally content files
this will put your text file inside the folder where it is installed on your client machine, I'm presuming you've already made the text file, if not simply create one by right clicking your project, add item, general tab and then text file.
EDIT
thankyou for the reply,
Rigt click your project, then choose properties and select the application tab you can change all the information by clicking Assembly Information...
EDIT 2
Theres a microsoft application called bizTalk that will do most of it all for you, there's a link with more information here http://msdn.microsoft.com/en-us/library/aa561017.aspx
EDIT 3
The best I can do after a lot of searching is to give you a path that will open a folder for you to place your readme into?
If you want to do that and tinker to see whether this path can be edited, then inside the file system of the installer, right click and press add special folder, then Custom Folder, name it what you like, something like ReadMeFolder? then right click and go to its properties change the DefaultLocation to whatever you like, but give it a property of ARPREADME, from here as soon as you've built and installed it, the folder path for this will be under the "readme" tab in your add and remove programs, there will be a way to change this so that it can target a file, Again I'll do a little more searching to see if i can make it open the file instead of the containing folder
Also have a mess around with making folders properties being ARP.... because the ARP stands for add remove program and its here that you can make the folder to certain things to do with the control panels Add & remove programs.

Categories

Resources