简体   繁体   English

Visual Studio C#项目模板:$ safeprojectname $参数

[英]Visual Studio C# Project Template: $safeprojectname$ parameter

Visual Studio C# Project Template: $safeprojectname$ parameter Visual Studio C#项目模板:$ safeprojectname $参数

i'm trying to create a project template and i want to replace some file names to safeprojectname. 我正在尝试创建一个项目模板,我想将一些文件名替换为safeprojectname。

It works for source file however it did not work project file (.csproj) itsef. 它适用于源文件,但不适用于项目文件(.csproj)。

  <TemplateContent>    
    <Project TargetFileName="$safeprojectname$.csproj" File="$safeprojectname$.csproj" ReplaceParameters="true">      
      <Folder Name="Definition File" TargetFolderName="Definition File">
        <ProjectItem ReplaceParameters="true" TargetFileName="$safeprojectname$.txt">$safeprojectname$.txt</ProjectItem>
      </Folder> 
    <TemplateContent>

Is it possible to use $safeprojectname$ in project file naming? 是否可以在项目文件命名中使用$ safeprojectname $?

MSDN says: MSDN说:

safeprojectname: The name provided by the user in the New Project dialog box, with all unsafe characters and spaces removed. safeprojectname:用户在“新建项目”对话框中提供的名称,其中删除了所有不安全的字符和空格。

If it is not possible to use $safeprojectname$ in projet name itself i need know the what are the unsafe characters that will removed . 如果无法在projet名称本身中使用$ safeprojectname $,我需要知道要删除的不安全字符是什么

i need know the what are the unsafe characters that will removed 我需要知道将删除哪些不安全字符

Same as what Path.GetInvalidFileNameChars() returns. 与Path.GetInvalidFileNameChars()返回的相同。 So in practice any character in :\\/*?"<>| . Note how these characters do special things when used at the command line and when composing a full path name. Having them appear in a project file name would cause lots of trouble. 因此,在实践中, :\\/*?"<>|中的任何字符:\\/*?"<>|注意,这些字符在命令行中使用时以及在组成完整路径名时如何做特殊事情。将它们出现在项目文件名中会带来很多麻烦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2008自定义类项模板,$ safeprojectname $ not reconciling - Visual Studio 2008 custom class item template, $safeprojectname$ not reconciling Sql脚本c#Web Project Visual Studio中的用户名参数 - Username Parameter In Sql Script c# Web Project Visual Studio .Net Core 2.0项目模板$ safeprojectname $ - .Net Core 2.0 project template $safeprojectname$ Visual Studio Solution(.sln) / C#:以另一个项目的 dll 作为参数启动一个项目 - Visual Studio Solution(.sln) / C#: Start a project with another project's dll as parameter Visual Studio C ++扩展模板项目? - Visual Studio C++ Extensibility Template Project? Visual Studio C# 项目模板 #if DEBUG #endif 在生成的项目中消失 - Visual Studio C# Project Template #if DEBUG #endif disappear in produced projects 包含 C# 和 C++/CLI 项目的 Visual Studio 2008 模板? - Visual Studio 2008 template containing both a C# and a C++/CLI project? 通过发布完成C#Visual Studio项目 - Completing a C# Visual Studio Project by publishing C#-Visual Studio项目构建 - C# - Visual Studio project build 如何修改 Visual Studio 的 C#.Net Core Console App 项目模板 - How To Modify Visual Studio's C# .Net Core Console App Project Template
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM