I have a VS 2022 MVC solution that contains three projects: two main projects and a support project. When I attempt to publish one of the projects, most of the files publish but only the first file under the area folder will publish. The files are marked as Content but the files never make it on the webserver. Anyone have an idea what I could possibly have set incorrectly?
I verified that the files are set to content but they don't copy.
Related
I just created a new project in Visual Studio 2019 and copied a bunch of files into the source/repos/project directory but they don't compile. I am guessing that is because these files were not created using Visual Studio.
Is there an easy way to make sure that the Project compiles all files in the directory even if they were created elsewhere? Right now all the files that I pasted in are treated like hidden files and the build option is a greyed out "None" instead of "Compile."
The files in question are all folders, PHP files, CSS, Javascript, etc.
See screenshot
enter image description here
I am building a "Solution" consisting of many small "Projects" within VS-2015.
To ensure consistency, I would like to set Project preferences such as additional include directories, additional libraries and platforms from one location or copy from one project to the next.
Could you please point me to a document that describes this?
Thanks in advance.
Since all projects are based on MsBuild, you can create a single targets file which sets the properties you want to sync across your projects. You can then import this targets file in every one of your project files.
To add a targets file you'll need to edit the csproj file directly (Unload project, edit project file in VS or through a 3rd party editor).
There are also some options like Directory.build.props and Directory.build.targets files, in Visual Studio 2017 these are automatically imported during your build and that gives you the advantage of not having to edit the project files. This may require MsBuild 15, which ships with Visual Studio 2017.
Some Visual Studio UI will be able to show the current value of certain properties, but editing them in the UI will pull these values back into to project files. This is an unfortunate behaviour of Visual Studio.
For all options to import targets files see:
https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2017
I'm using Visual Studio 2015 update 3 with TFS hosted at visualstudio.com.
When I add a C# class file to one of my projects in Visual Studio, it's not automatically added to source control. For other projects in the same solution, C# class files are added automatically, as expected.
When I then add the file, manually, in the project with this problem, I get the following question;
I have to confirm to add the file to source control.
There is a similar question (Visual Studio 2015 new files not being added to source control automatically), associated with a "release" branch, which is not the case here (at least I think so - our TFS-project has never been branched)
We've never configured any .tfignore manually.
This started to happen recently and occurs on all development machines, so it's probably not a client machine issue.
I'm clueless, so any help is highly appreciated.
UPDATE
I've discovered that the problem occurs in projects with names ending with ".Lib"
Projects:
Core (ok)
Core.Lib (files not added automatically)
Communication (Ok)
Communication.Lib (files not added automatically)
I tried to add a test project Test.Lib to my solution. This project was not added to TFS either, but project Test was.
The "lib" extension is the problem. Try renaming the project folder to something else, eg. "CoreLib".
To reproduce this behavior / bug, try the following:
Create a Test directory in a directory controlled by TFS
Create a Test.Lib subdirectory in this directory.
Add a file, test.cs, to Test.Lib. (Test\Test.Lib\test.cs)
In Visual Studio's Source Control Explorer, try adding the new Test directory to source control. You'll see test.cs on the "Excluded items" tab.
The "lib" extension is used by binary files, and these are ignored by Team Explorer by default. I haven't found an official list of filetypes anywhere, but other affected file types are dll, exe, obj and possibly others. You can include these files manually by right-clicking them and selecting "Include".
I got some files necessary for the hosting environment, e.g: robots.txt as in the attached image.
But I don't want to store them in Visual Studio solution, because they are not a part of my project, it will be confusing to have these under the solution folder or source control.
So, I am thinking is there anyway to let Visual Studio automatically copy these files from my custom location (e.g: D:\HostingPrepareForST\ ) to the output folder when I hit "Publish" to publish the website?
If a VS2008 project is created initially with a web app project, and class projects are added, and the structure is like this:
Parent Folder
Web App Project Folder - (solution Files in this folder)
Class Project 1
Class Project 2
...
do you see any problems with moving the .sln and .suo files to the parent directory?
Parent Folder - (solution Files in this folder)
Web App Project Folder
Class Project 1
Class Project 2
...
I adjusted the .sln project directories and the solution seems to be working fine, but I'm wondering if this action will break something I didn't anticipate.
Only the project files determine their build outputs - solutions only link projects together into a logical entity, so that they can be loaded at the same time in a Visual Studio instance. If the projects are still the same, nothing's broken.
And the .suo file can be safely deleted. It's a user-specific file that simply retains a particular user's options for a solution. It contains nothing that's important to projects, build settings etc.
You can open your .sln file with whatever editor you'd like, even notepad, and see that it contains only references to your project files in it, you can modify it so that the relative paths to your project files in it match your layout. VS wouldn't have anything against it.
All build settings are stored in project files, so you don't loose any configuration changes you've done in your projects.