visual-studio 空的 Visual Studio 项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1836805/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Empty Visual Studio Project?
提问by Michael Stum
Is there a way to have an empty Project in Visual Studio 2008 or 2010? I do not mean an empty solution, I mean an empty project in a solution. Basically I have a solution with multiple projects, and I want to add a project to track some static files that are part of the solution but not of any specific project. Adding them as solution files doesn't work because solution folders are not mapped to file system folders and I want to manage hierarchy from Visual Studio.
有没有办法在 Visual Studio 2008 或 2010 中创建一个空项目?我的意思不是一个空的解决方案,我的意思是解决方案中的一个空项目。基本上我有一个包含多个项目的解决方案,我想添加一个项目来跟踪一些属于解决方案但不属于任何特定项目的静态文件。将它们添加为解决方案文件不起作用,因为解决方案文件夹未映射到文件系统文件夹,我想从 Visual Studio 管理层次结构。
At the moment I create an empty Visual C# project which works, but I just wonder if there is a "more empty" project.
目前我创建了一个空的 Visual C# 项目,但我只是想知道是否有一个“更空”的项目。
采纳答案by Michael Burr
The Visual C++ project types has an "Empty Project" in the "General" category.
Visual C++ 项目类型在“常规”类别中有一个“空项目”。
It comes up with several empty folders ("Header Files", "Resource Files", "Source Files") that are just 'filters' (they aren't on the file system). You can just remove them.
它提供了几个空文件夹(“头文件”、“资源文件”、“源文件”),它们只是“过滤器”(它们不在文件系统上)。你可以删除它们。
It also has all the properties of a C++ project available, so don't put C/C++ files in there unless you want them built (or you exclude them from the build).
它还具有 C++ 项目的所有可用属性,因此不要将 C/C++ 文件放入其中,除非您希望构建它们(或者将它们从构建中排除)。
Other than that, it's pretty empty.
除此之外,它非常空旷。
Probably even closer to an "empty project" is a "Makefile Project" which is also located in the "General" category of the Visual C++ project templates. It also creates the 3 filter folders, along with a readme.txt file that you can delete. It has the advantage that unless you specifically give it commands to run during the build, it won't do a damn thing.
可能更接近“空项目”的是“Makefile 项目”,它也位于 Visual C++ 项目模板的“常规”类别中。它还创建了 3 个过滤器文件夹,以及一个可以删除的 readme.txt 文件。它的优点是除非你在构建过程中专门给它运行命令,否则它不会做任何该死的事情。
回答by Jeson Martajaya
I was misled by the C++ "Empty Project" or "Makefile Project". I cant create new folder there.
我被 C++“空项目”或“Makefile 项目”误导了。我无法在那里创建新文件夹。
Here are three steps to add an empty C# project:
以下是添加空 C# 项目的三个步骤:
1) Create the project. (Add > New Project > Visual C# > Windows > Empty Project)
1) 创建项目。(添加 > 新建项目 > Visual C# > Windows > 空项目)
2) Exclude it from build. (Build > Configuration Manager, uncheck Build on both Debug and Release configuration)
2)从构建中排除它。(构建 > 配置管理器,在调试和发布配置上取消选中构建)
3) Replace its csproj content with the following 3 liners:
3) 将其 csproj 内容替换为以下 3 行:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>
There you go. You can create a folder in this project, yet it does not build.
你去吧。您可以在此项目中创建一个文件夹,但它不会构建。
回答by NightShovel
I found an "Empty Project" under the "Windows" category in both C# and Visual Basic, in Visual Studio 2012. I'm unsure if these are present with Visual Studio 2008 or 2010.
我在 Visual Studio 2012 中的 C# 和 Visual Basic 的“Windows”类别下发现了一个“空项目”。我不确定这些是否存在于 Visual Studio 2008 或 2010 中。
It seems to only create an App.Config file, which can easily be deleted.
好像只创建了一个 App.Config 文件,很容易删除。
回答by spinxz
回答by Niklas Peter
I think the C++ empty project does support folders. At least in VS 2013 you just have to click on "Show all files" in the Solution Explorer. Then it will not show these virtual folders (filters) anymore, but real folders in the file system and then you can also create new folders, ...
我认为 C++ 空项目确实支持文件夹。至少在 VS 2013 中,您只需单击解决方案资源管理器中的“显示所有文件”。然后它将不再显示这些虚拟文件夹(过滤器),而是显示文件系统中的真实文件夹,然后您还可以创建新文件夹,...
回答by H3sDW11e
Microsoft Visual Studio 2019 Community
Microsoft Visual Studio 2017 Community
Microsoft Visual Studio 2015 Community
Microsoft Visual Studio 2019 社区
Microsoft Visual Studio 2017 社区
Microsoft Visual Studio 2015 社区
for creating in WPF an Empty Project,
go File > New Project
then Templates > Visual Basic > Windows > Classic Desktop
use this reference to find Empty Project for other Languages;

要在 WPF 中创建一个空项目,
请转到文件 > 新建项目,
然后转到模板 > Visual Basic > Windows > 经典桌面,
使用此参考找到其他语言的空项目;

now to work with this Empty Project, References must to be Add to the Project;
in Solution Explorer, right-clickReferencesthen Add Reference...
select these references: PresentationCore, PresentationFramework, System.Windows, WindowBase;
then click OK;
现在要处理这个空项目,必须将引用添加到项目中;
在解决方案资源管理器中,右键单击引用,然后添加引用...
选择这些引用:PresentationCore、PresentationFramework、System.Windows、WindowBase;
然后点击确定;
now you Solution Explorer should look like this :
starting coding and creating your Dynamic Generated WPF Application;
follow these steps if more References are needed depending on the code used;
开始编码并创建动态生成的 WPF 应用程序;
如果根据所使用的代码需要更多参考,请按照以下步骤操作;
回答by Paul Creasey
Sounds to me like you want a solution folder!
在我看来,您想要一个解决方案文件夹!

