首页 \ 问答 \ VS2017 - 框架4.6.2不是在c#中的类库项目中显示的选项,但它是在一个vb窗体中的一个窗体中(VS2017 - Framework 4.6.2 is not shown as an option in a class library project in c#, but it is in a vb windows forms one)

VS2017 - 框架4.6.2不是在c#中的类库项目中显示的选项,但它是在一个vb窗体中的一个窗体中(VS2017 - Framework 4.6.2 is not shown as an option in a class library project in c#, but it is in a vb windows forms one)

这是相同的视觉工作室2017 instalation。 我已经从这里下载并安装了net framework 4.6.2开发包

我创建的窗体项目

我已经下载并希望切换框架的类库项目

问候!


It's the same visual studio 2017 instalation. I've already downloaded and installed the net framework 4.6.2 developer pack from here

windows forms project I've created

class library project I've downloaded and want to switch framework

Regards!


原文:https://stackoverflow.com/questions/50118859
更新时间:2023-06-13 19:06

最满意答案

CMD有许多具有特殊含义的字符,通常被称为“毒性字符”,因为如果它们暴露给批处理解析器,它们可能会导致许多不需要的影响。 示例包括& | > < - 还有更多。

通常,如果字符引用为">" ,或者像^>那样转义,则不会导致问题。 但是你无法控制用户输入的内容。 使用正常扩展时,某些值不安全。 例如,如果用户输入This & that "& the other thing" ,则无法在值周围添加引号,以便引用两个&

值得庆幸的是,延迟扩展提供了一个简单的解 而不是使用%VAR%扩展变量,而是使用!VAR! 。 解析器完成查看所有字符扩展变量,因此毒性字符不会导致任何问题。 必须首先使用setlocal enableDelayedExpansion启用延迟扩展

这是一个简单的演示,无论出现什么毒性字符,都可以成功地ECHO用户键入的任何值。 您可以轻松地将代码调整为IF语句。

@echo off
setlocal enableDelayedExpansion
set /p "var=Enter a string: "
echo You entered: !var!

CMD has many characters that have special meaning that are often referred to as "poison characters" because they can lead to many unwanted effects if they are exposed to the batch parser. Examples include & | > < - there are more.

Generally, the characters do not cause problems if they are either quoted like ">", or escaped like ^>. But you don't have control over what the user enters. Some values simply are not safe to work with using normal expansion. For example, if the user enters This & that "& the other thing", then there is no way to add quotes around the value such that both & are quoted.

Thankfully, delayed expansion provides a simple solution. Instead of expanding a variable using %VAR%, you use !VAR!. The variable is expanded after the parser finishes looking at all the characters, so the poison characters do not cause any problem. Delayed expansion must first be enabled by using setlocal enableDelayedExpansion

Here is a simple demonstration that will successfully ECHO any value the user types in, no matter what poison characters are present. You can easily adapt the code to an IF statement.

@echo off
setlocal enableDelayedExpansion
set /p "var=Enter a string: "
echo You entered: !var!

相关问答

更多
  • 在if语句中测试时,您没有将userinput包装在%%中,因此程序将其解释为纯文本而不是变量。 尝试: @ CLS @ set /P name="Type your name: " @ set /P userinput="Type your name again: " @ if /I "%userinput%"=="%name%" goto correct @ if /I "%userinput%"=="my name is %name%" goto correct @ goto :incorrect @ ...
  • 是的,因为value属性的引号( " )缺失。 这与spring-mvc甚至java无关。 它与html相关 - 你应该总是引用你的属性。 Yes, because quotes (") for the value attribute are missing. This ...
  • 如果你输入一个带有空格的字符串, if语法会给你一个语法错误。 让我们看看: if hello world == string echo xyz if语法是: if command 所以hello ,值1, world是比较 - 等 - 什么? world不是比较器 - 语法错误。 把你的值放在quoutes中以保证安全: if "hello world" == "string" echo xyz 所以"hello world"是value1 ...
  • 如何遵循脚本? 此脚本等待3秒,而“file.mp4”不存在。 它一直等到文件存在。 关于“文件名”,你可以改变你的脚本。 @echo off set waittime=3 set filename=file.mp4 :loop if not exist %filename% ( Timeout /t %waittime% /nobreak > nul goto loop ) echo Find %filename% How about following script? This script ...
  • CMD有许多具有特殊含义的字符,通常被称为“毒性字符”,因为如果它们暴露给批处理解析器,它们可能会导致许多不需要的影响。 示例包括& | > < - 还有更多。 通常,如果字符引用为">" ,或者像^>那样转义,则不会导致问题。 但是你无法控制用户输入的内容。 使用正常扩展时,某些值不安全。 例如,如果用户输入This & that "& the other thing" ,则无法在值周围添加引号,以便引用两个& 。 值得庆幸的是,延迟扩展提供了一个简单的解 而不是使用%VAR%扩展变量,而是使用!VAR! ...
  • 阅读help set延迟扩展。 默认情况下,当cmd解析一行时,会扩展环境变量( %foo% )。 在这种情况下,一行是一个单独的语句,可以包括一个完整的加括号的块。 因此,在解析块之后,所有出现的环境变量都将在解析时替换为其值。 如果您在块中更改了一个变量并再次使用该变量,则会看到原来的值,因为它已被替换。 延迟扩展,可以使用 setlocal enabledelayedexpansion 会导致环境变量标记为感叹号,而不是百分号( !foo! )在执行解析后的语句之前直接进行评估。 @echo off ...
  • @ECHO OFF SETLOCAL SET "sourcedir=c:\sourcedir" SET "destdir=c:\destdir" SET "textfiles=c:\bpd\*.txt" :: For my testing SET "textfiles=q20649661.txt" FOR /f "usebackqtokens=1,2delims=, " %%a IN ("%textfiles%") do ( IF EXIST "%sourcedir%\%%a*.pdf" ( ECHO ...
  • 下面的批处理文件检查插入的日期是否具有正确的格式,并且它代表有效的日期,即每个月有适当的天数,即使在闰年的2月也是如此! @echo off setlocal EnableDelayedExpansion set i=0 for %%a in (31 28 31 30 31 30 31 31 30 31 30 31) do ( set /A i+=1 set dpm[!i!]=%%a ) set /P "inDate=Please insert date (MM-DD-YYYY format ...
  • 或者纯批次...... @echo off setlocal EnableDelayedExpansion call :FirstUp result hello echo !result! call :FirstUp result abc echo !result! call :FirstUp result zynx echo !result! goto :eof :FirstUp setlocal EnableDelayedExpansion set "temp=%~2" set "helper=# ...
  • 目前还不清楚else if你的代码中else if一部分代码是你正在尝试使用的。 readline()的本质是它将返回用户输入的字符串。 输入中是否包含任何不想包含的特定字符? 您可以使用grepl()来标识它们并防止用户将它们作为输入输入。 如果您试图确保用户输入了某些内容,则应按照注释中的建议使用while循环。 如果要在函数运行后在R中使用变量,则需要return() v1的值 - 用户输入。 如果您试图用%20替换名字和姓氏之间的空格,那么您可能需要使用gsub() 。 请参阅下面的代码。 fun1 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。