letsgo快连

letsgo快连

It turns out that a lot of people commit a copy of nuget.exe into their code repositories.
There are currently almost seventy-three thousand copies of this file in public GitHub repositories.
Some of them used to be mine. Not anymore.



tldr: don't include a copy of nuget.exe in your repository. Instead, add a reference to Nuget.CommandLine and use the copy of the exe the package provides.


It's rare to think about how NuGet works. You can just add the packages to your project, they get downloaded, referenced and everything just works.

But there are some things you might do with NuGet where you can't rely on MSBuild (or similar) to take care of things for you.

You may have to call `nuget.exe` directly.
I've had to do this many times and when doing so it's raised a tricky question.
"Where is nuget.exe located?"
Across all development machines and build/CI servers, there's no single answer.
You can't rely on it being in a particular place. unless you put it there.

如何解决访问国外ERP服务器及跨境办公难题?-解决方案问题 ...:2021-6-8 · 知名好用国外服务器推荐 如何租用国外服务器?服务器在国外,如何提高国外服务器访问速度?国外服务器租用风险有哪些?外贸仿牌抗投诉服务器哪里有?选择租用国外服务器托管的好处 国外服务器使用CDN加速怎么样 亚洲高防服务器租用怎么样,抗攻击性能
I've never found any documentation to explain this and so put it in the repository with the code/scripts/whatever that needed it.

It never felt like the right thing to do but I didn't know any better and it seemed to work ok.
As we saw above, I'm far from the only person to have done this.
The only time this became a problem was when I needed to change something that called nuget.exe and needed a feature that was added in a newer version than the one I had checked in. Not a big deal but another reminder that this isn't the best way to do things.

A couple of weeks ago I stumbled across the NuGet.CommandLine package. Again, documentation of this package wasn't something I could find but the name had me wondering. "Could this be the way to perform the command-line NuGet operations I've always wanted?"

Some investigation was needed.

I started by downloading the package and looking inside.


Bingo! That looks exactly like what I need.

可众连接国外线路的加速器

Fortunately, this is where some documentation did come in handy.

By adding `GeneratePackagePath="true"` to the PackageReference element I could have a way to get access to the version of the executable from the package.


Now to use it.

By adding this property a new build parameter is created. It has the same name as the package but with two differences. Firstly it's refixed with "Pkg" and secondly, is has non-alphanumeric characters replaced with underscores. so, in this instance, the parameter is called `PkgNuGet_CommandLine`.

With this all set, I could now reference the version of nuget.exe that was downloaded as part of the package by specifying `$(PkgNuGet_CommandLine)\tools\nuget.exe`. As an example, see this targets file, which I use to automatically pack and sign release builds of packages.

That was it. Simple really, but poorly documented. I was surprised how easy it was to fix and why I've never seen anyone mention this before. Maybe other people do talk about this. Maybe other people know this already. That the package has sooooo many downloads makes me suspect that many people do already know this. But the number of repositories containing this file on GitHub also makes me certain I'm not the last person to learn about this.
If you're in the position I was, I encourage you to make the switch to using the package reference instead. Not only will you save a bit of space in the repository but, more importantly, you'll be able to learn when newer versions of the exe become available when a new version of the package becomes available.

---

I originally investigated the above while streaming on Twitch.  I like to stream there while investigating or researching topics as it forces me to articulate what I'm thinking, doing, and looking for, without getting distracted. Hopefully, it serves as an interesting way for others to learn what I'm learning. Follow me on Twitch to learn when I next do things like this and we can all learn together.
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Read More

letsgo快连

You've only added two lines - why did that take two days!

It might seem a reasonable question, but it makes some terrible assumptions:
  • lines of code = effort
  • lines of code = value
  • all lines of code are equal
None of those are true.

Why did a fix that seems so simple when looking at the changes made take two days to complete?
  • Because the issue was reported with a vague description of how to recreate it. It took me several hours to get to a reliable reproduction of the item. Some developers would have immediately gone back to the person reporting the problem and required more information before investigating. I try and do as much as I can with the information provided. I know some developers don't like having to fix bugs, and so do whatever they can to get out of it. Claiming there isn't enough is a great way to look like you're trying to help but not have to do anything. I know that reporting errors can be hard, and I'm grateful for anyone who does. I want to show appreciation for error reports by trying to do as much as possible with the information provided before asking for more details.
  • 六毫秒加速器App-六毫秒加速器下载 1.0.1 安卓版-新云软件园:2021-6-12 · 六毫秒加速器是成都俊云科技有限公司打造的一款方便快捷的加速器软件,限时试用加速玩国服游戏、浏览国内视频,直播、音乐等各大主流平台,听歌追剧刷视频,低延迟极速畅联玩到爽,欢迎下 … The feature it was to do with was something I rarely use and is not something I've ever used in great detail. This meant it took me longer than it might to understand how to use it and the nuances of how it interacts with the software with the bug.
  • 次元连接加速器_次元连接二次元加速器_次元连接吧:2021-9-7 · 次元连接 二次元游戏加速器 - 蜗牛娱乐网 2021年9月7日 - 次元连接 二次元游戏加速器时间:2021-09-07 来源:本站原创 作者:蜗牛 -小 +大安卓手游加速器,大部分都是日服游戏,主流日服游戏都有,目前 …. If some code is throwing an error, you could just wrap it in a try..catch statement and suppress the error. No error, no problem. Right? Sorry, for me, making the problem invisible isn't the same as fixing it. "Swallowing" an error can easily lead to other unexpected side-effects. I don't want to have to deal with them at a point in the future.
  • Because I investigated if there were other ways of getting to the same problem, not just the reported reproduction steps. One set of reproduction steps can easily make the error appear to be in one place when it may actually be more deep-seated. Finding the exact cause of a problem, and looking at all the ways to get there can provide valuable insights. Insights such as how the code is actually used, where there might be other places with possible (other?) problems that might need addressing, or it may show inconsistencies in the code that mean an error is caused (or handled) in one code path but not another.
  • Because I took the time to verify if there were other parts of the code that might be affected in similar ways. If a mistake led to the bug, the same error could have also been made elsewhere in the code-base. Now's a great time to check. 
  • 海外听歌,用海龟加速器超简单 - 简书:而且海龟加速器可众选择智能模式,打开智能模式后,不会影响Facebook、ins等国外软件的使用,不像很多加速器是全局加速的,打开后只能使用国内网络,国外的软件反倒是不能用了,在这一点上海龟加速器 …. I don't want the quickest possible fix. I want a fix that isn't likely to cause confusion or other problems in the future.
  • Because I tested the change thoroughly and verified that it addressed the problem for all the different code paths that were affected. I don't want to rely on someone else to have to test that what I've done is correct. I don't want a bug to be found in the future and for me to have to come back to this code when I've mentally moved on. Context switching is expensive and frustrating. Having a dedicated tester have to look at the "same" change again is something I want to avoid whenever possible.

I don't like having to fix bugs. Partly because they can feel like the result of a previous failure on my part. The other reason I don't like fixing bugs is that I'd prefer to be working on new things.

What's worse than having to fix a bug?
Having to fix the same bug repeatedly.
I take the time to make sure any bug is totally fixed any time it is encountered so that it doesn't need to be faced, investigated, fixed, and tested more than once.


  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Read More

letsgo快连

Announcing: Rapid XAML Toolkit release 0.10

Yes, 0.10 means it's getting excitingly close to a full 1.0 release and the removal of the preview tag.
Wider events and that some of what I'm trying to do with the toolkit has turned out to be much, much harder than I originally expected and means it's taking longer than I hoped but progress is being made.


What's new?

There are three big new items with this release:


  • 1- Custom XAML Analysis

I compare the XAML Analysis functionality to Roslyn Analyzers (and code-fixes) for C# (or VB.NET). The big difference is that you can create your own Roslyn Analyzers to check (and fix) code in any way you wish.

There are 六毫秒加速器App-六毫秒加速器下载 1.0.1 安卓版-新云软件园:2021-6-12 · 六毫秒加速器是成都俊云科技有限公司打造的一款方便快捷的加速器软件,限时试用加速玩国服游戏、浏览国内视频,直播、音乐等各大主流平台,听歌追剧刷视频,低延迟极速畅联玩到爽,欢迎下 …, but the way it works is:

- Create a 'Custom Rapid XAML Analyzer' project (This template is now part of the toolkit.)
可众加速国外软件的加速器
- Specify the type of element the analyzer relates to.
- Add the logic for analyzing the element and indicating what actions, if any, should be displayed.

It means you can easily create things like this:


The code for the above is a proof-of-concept and can be seen here. Hopefully, it's easy to read.
The method queries an object representing the XAML in the document and returns a response that handles what to display and what, if anything, to do to fix it. The tool takes care of all the interaction with Visual Studio and making the changes. You can't do *everything* but hopefully, it's most, if not all you need.


  • 2- Perform XAML Analysis at build time

The Visual Studio extension does analysis at design-time. It gives feedback on the documents you have open.
This new package allows for the evaluation of ALL the .xaml files in a project when the project is built. This means you won't miss something in another file. It means you can check files that anyone works on, even if they don't have the extension installed. It even means you can incorporate analysis checks as part of a CI/DevOps process. Don't want someone to check-in invalid XAML to your repo?--now you can. ;)
Yes, this also works with custom analyzers.

  • 3- A new promotional website: http://rapidxaml.dev 



What's still to come?

There are a number of little things I still want to add before calling it version 1.0.
There are also a few bugs that need fixing and some experimental ideas that might get in for the 1.0 release.


Background

If you don't know. The Rapid XAML Toolkit started out as an open-source project in a Microsoft repo on GitHub as a collection of tools to make it easier to create and work with XAML files, whether that be in WPFUWP, or Xamarin.Forms apps. Last year the decision was made that it wouldn't be released by Microsoft and the functionality wouldn't be incorporated into Visual Studio. So, I, as a major contributor, took ownership of the repo and will be releasing it myself.
I believe it contains useful functionality that will empower every XAML developer on the planet to achieve more.


可众连接国外线路的加速器

  • Install the extension - give it a try.

If you had the preview version installed (the one called "Rapid XAML (Preview)"), you should uninstall that first.

  • Visit the website
  • Give feedback - in whatever way works for you. Here, on twitter, or on 能用国外软件的加速器.


  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Read More

letsgo快连

Never set 'Copy To Output Directory' to 'Copy always'

What if there was a simple setting that could save you hours?


I thought there was something wrong with the Test Explorer.
I'd make a change in a configuration file that was used by some of my automated tests. Then I'd run all the tests again to see if that broke/fixed anything.
Only, it would take a couple of minutes - before the tests even started! Because the code was being recompiled first.
I would get frustrated.
I would lose my flow.
It was not an enjoyable or productive situation to be in.

And, I thought the culprit was the test harness. Why was it triggering a rebuild of the code? And a rescanning of the built assemblies to look for tests? When nothing in the code had changed?
All that was changed was an external file that was referenced by some of the tests.

It turns out, the problem was due to my lack of understanding of how MSBuild works and how the value of the Copy to Output Directory property is used.

---

For years I've been concerned by the number of times I've heard developers told to set the value of the Copy to Output Directory property (to a value other than "Do not copy") for files that have no need to be copied to the output directory. It seemed like a waste of effort. If the file wasn't needed in the output directory, why waste effort (admittedly--not a lot of effort) copying files around? Ultimately, this didn't seem all that important. I found more important things to focus on and stopped worrying about other people copying files unnecessarily.
Maybe I shouldn't.
Maybe I should have actually learned more about the setting. It may have helped me sooner.

---

I lived with it, taking a while to rebuild and then run my tests. Until I couldn't.
A few weeks ago, I reached my breaking point. I couldn't take it anymore. I would find out why my code was being rebuilt unnecessarily. Even if it took days, I would be better off in the long run to address this delay. If it was something I was doing, I'd fix it. If it was a genuine bug in the tools, I would find out where and raise it accordingly.

You're smart enough to know that I wouldn't have gotten this far if I didn't have a conclusion to this story. I know you've also figured out from the title of this post what the solution was. Anyway...

It took me the best part of the day reading through diagnostic build logs and testing me to the limits of my web-searching abilities but I got there in the end.
The "culprits" were files with the "Copy to Output Directory" set to "Copy always".

Ok, but why?

That's a very good question, and one I asked too.

It turns out that the behavior is due to the way this value is interpreted.
If you know that you always want the latest version of the file in the output directory, under some conditions, it can be quicker (and easier) to copy the file than spend time determining if the files are different.
That's good, but why does it trigger a rebuild? Why not just copy the file built previously?
Because the file built previously may have been modified (or created) by the build. The build process interprets "Copy Always" to mean "copy the file once the build has completed, so it's the most recent version." Because the build process may modify the file, it must rebuild the project to ensure that the file is the latest version. This is easier than trying to work out if the file will be changed by the build process before it is run. (If that's possible at all.)

So, to make that clear:
- "Copy always" means "make sure I always have the most up to date version."
- Because the build process may modify the file, the build process must be run to make sure you have the most up to date version of that file.

As an alternative, "Copy if newer" won't force a rebuild. The argument for why this is the case is (in my opinion) a bit vague, but it avoids those unnecessary builds, and that's what I'm interested in here.


Given how it works, why might you ever want to use "Copy Always"?

I don't know an official reason, but the only one I could come up with is if you needed a file to have a timestamp that corresponds to the build time. That's it.
I can think of no other reason to use the setting "Copy always." Please share if you have another.



Ok. So, what can you do to make sure you're not using the "Copy always" setting?

There are three options.
  1. You could step through every file and check the property. - Very slow. Very tedious, and likely you might miss something.
  2. SSR加速器怎么用?安全使用SSR加速器的一些注意事项 ...:2021-12-21 · SSR加速器使用注意事项之SSR加速器客户端篇 国内各大科技厂商,窥探隐私的欲望比较强烈,有鉴于此: 1.无论是电脑还是手机科学上网,建议不要安装国产杀毒软件。
  3. Install this extension, and it will check every project for you whenever you open one. If it finds a file with the dreaded "Copy always" setting, it will let you know in the output window. It also adds a context menu entry on the project file to fix (change to "copy if newer") all files in that project.
可众连接国外网的软件




Please install this Visual Studio extension and let me know how you find it or if there are any scenarios it doesn't handle.

.


Was the above useful?
Did you learn anything?
Have you changed a project (or projects) you work on because of this?
Have you thought about how much time this can save you? How much time is spent on each unnecessary build?
How many times each day is your code rebuilt when nothing has changed? How many days will you spend (have you spent) working on that code? How many people are/will working/work on that code-base?
Could it add up to hours?
And how much is an hour worth to you? Or the company you work for?
Isn't that at least worth buying me a coffee to say thank you?
While we can't do it in person, you can do it virtually via http://www.buymeacoffee.com/mrlacey.
I'll be very grateful for whatever you can contribute.
Or, you could sponsor me to continue to create tools like the extension mentioned above by becoming a sponsor on GitHub.

  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Read More

letsgo快连

六毫秒加速器App-六毫秒加速器下载 1.0.1 安卓版-新云软件园:2021-6-12 · 六毫秒加速器是成都俊云科技有限公司打造的一款方便快捷的加速器软件,限时试用加速玩国服游戏、浏览国内视频,直播、音乐等各大主流平台,听歌追剧刷视频,低延迟极速畅联玩到爽,欢迎下 …

云豹浏览器下载-云豹浏览器正式版下载[浏览器]-华军软件园:2021-5-11 · 云豹浏览器正式版是款可众浏览各种国外文章的网页浏览工具。云豹浏览器最新版中用户能一键智能连接国外网络设备,让你更好的在软件中能更好的了解国外热点新闻。云豹浏览器不仅能够支持多条国际专线,有效减低跨境传输造成的网络延时,还拥有丰富网络传输线路,覆盖全球绝大多数地区 ...making {some software} open source won’t cost {company} anything,” but I did today.

Not being able to find an existing list of reasons why this isn’t the case, here are a few quick thoughts:

  • Any change in ownership requires people to make decisions and take action. Doing so requires more time than it takes to open a repository, copy some files, and push the commit. Time takes money, and so has a cost to the company.
  • The code must first be checked for the risk of revealing any potential security holes. Detailed code reviews take time from experts, and so aren’t free.If the released code risked showing a potential vulnerability to existing users of the software, that’s something the company will need to address. It might be easier/cheaper not to release the code.
  • The code must first be reviewed for IP and licensing issues. Does the company want all the code released under an open-source license? If not all of the source code (and assets) can/should be released, what should they do about the parts that can’t?Or what if the code depends on libraries or other licensed resources from elsewhere?
  • The ongoing management of an open-source project takes time (and therefore money.) If the intention is to create an ongoing, community-driven project, it will need (at least initially) some leadership and guidance. Releasing the code under an opensource license and then leaving it for anyone to do with it as they wish, is less likely to lead to a single release that continues the legacy of the original.
  • If releasing the code for use as anyone wishes, then pre-existing branding, trademarks, names, etc. must be removed or changed. If not performing such modifications before the code is released, it may be necessary to verify that anything released based on the original source has such identifying elements removed. 




“Cost nothing” is not the same as “won’t cost much.” If you’re trying to persuade someone to do something, being specific, and understanding what matters to them and how they make decisions can help build a persuasive argument.



An additional nod to Sébastien for pointing me to this explanation of turning Windows Live Writer into Open Live Writer as an example of the steps/processes involved that must have cost effort/time/money.

  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Read More
Older Posts Home