Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Record a pit in Visual Studio 2015 CTP 5 again

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

After upgrading to VS2015 CTP, I want to change something in the project today, and then I have to change the syntax code changed in C # 6.0.First of all, for example, the following sample code:

Var fullName = "\ {customer.FirstName}\ {customer.LastName}"

There is a lot of similar code in the project, which has to be changed. What should I do? Change it manually? Forget it, let's modify it in batches, but how to replace it in batches? is it possible to directly replace "{" with "{", but how to add "$"? I've been thinking about this for a long time, and then I want to replace it with regular expressions, but the grammar can't write it. Alas, the last way to replace it is to manually + replace, replace "\ {", and then manually add "$" to the string.

It is important to note that do not replace "\ {" in batches, because after replacement, you do not know where to use the string variable, because it will take "{" as part of the string without error prompts and smart prompts. Remember, if you replace it like this, you're dead.

Record another one. Previously, in "{", it was possible to write trinomial expressions, such as the following:

Var fullName = "\ {customer.FirstName = =" xishuai "?" cnblogs_xishuai ": customer.FirstName}\ {customer.LastName}"

However, replace it with the current syntax features, such as the following:

Var fullName = $"{customer.FirstName = =" xishuai "?" cnblogs_xishuai ": customer.FirstName} {customer.LastName}"

If it is written in this way, it will make a mistake, and this problem has bothered me for a long time. Is this not supported?. Finally, after working for a long time, I found that I wanted to add "()" to the expression, as follows:

Var fullName = $"{(customer.FirstName = =" xishuai "?" cnblogs_xishuai ": customer.FirstName)} {customer.LastName}"

It's not over. In other words, I've changed almost. I think I've changed all the syntax features of the code, and then I confidently "Build", and then something like this happens:

Error message: "Metadata file 'xxxxxx.dll' could not be found" CSC, I had a headache when I saw this problem, and then I searched all over Google. The basic solution is:

Clean every project individually (Right click > Clean).

Rebuild every project individually (Right click > Rebuild).

Rebuild the startup project.

Invalid, search again, try again, invalid, search again, try again.

To solve a problem, if you go in the wrong direction, you will die miserably, as I am now.

Guess what in the end? There is still a code problem, there is a syntax feature of the class library code has not been changed, my God, why the error prompt of VS2015 CTP is not displayed, but shows some messy things, the last place to find is Output (output window):

Error CS1009: Unrecognized escape sequence

Seeing such a mistake, I was relieved and wanted to change the code.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report