Edi Wang

.NET and Azure Developer

Visual Studio

Stop Generating Designer.cs for .resx files in .NET Core

In Visual Studio, if we add a Resource File (.resx) to a .NET Core project, you will find a ".Designer.cs" file is automatically generated and updated whenever the resource content changes. This file basically contains auto-generated code for accessing resource values by key. In my blog system, I use the Resource File to maintain the default configuration data when setting up the blog for the …
.NET Visual Studio

Recommended Visual Studio Configuration for .NET Core Development

Visual Studio has always been a good friend to .NET developers, although VS Code can do .NET Core development, VS is still having a lot advantages. Let's see how to make Visual Studio more handy for .NET Core development. Basic Configuration First, please be advised, not all versions of Visual Studio supports .NET Core development, even some early version of VS2017. Some people may mistake for …
.NET Visual Studio

Windows 10 UWP: How to Debug OnFileActivated Launch Failure

Today I am working on my Image Portray App, and I get my code blown up. The problem is, when the App is already started, it can open .ink file with double click from a file. But when the App is not launched, opening a .ink file to start the App will make it crash. As other UWP that supports file type association, I also use OnFileActivated event to launch my App. This kind of problem could not be …
Debug Visual Studio UWP

How to move Microsoft Azure Application Insights

本文目前仅适用于国际版的Azure,国内版没有Application Insight服务,请注意。如果你还没有感受过Application Insight这个人类的最新希望,可以到大微软的Channel 9电视台学习一下:http://channel9.msdn.com/Series/Application-Insights-for-Visual-Studio-Online 另外,本文所说的迁移方法不会保留Application Insight的历史数据,如果你看到这里就想喷:你TM在逗我?这叫什么迁移? 。。。 那还是别往下看了。我的标题叫迁移,是因为我实在找不到别的词了。 如果你换了个Microsoft Azure的订阅,怎么迁移以往的ASP.NET, WP工程上面已经配置好的Application Insight呢?目前Azure Portal没有提供更改订阅的功能。所以我们只能在 …
Visual Studio Azure Application Insight

How to Change TFS Server URL in Visual Studio

今天又给大家带来一个实用装逼技巧。这个故事的起因是我无意中发现微软的TFS Service支持URL重命名了,非常牛逼,就像这样: 但带来的问题就是我们需要手动更改以前所有使用这个TFS地址的地方。Visual Studio就是首当其冲的了。很可惜,在VS里面,是没有办法直接编辑TFS地址的。 如果删掉重建的话,还需要把之前所有的本地文件夹都映射一遍,万一玩脱了就爆了。所以还是建议去注册表手动修改。 要修改的位置是: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\TeamFoundation\Instances (如果你用的是VS2010,就把11.0换成10.0) 第一处:定位到原TFS地址的文件夹,把右边的Uri字段改掉。 第二处: 还有有个很阴巴的文件夹,藏在你的TFS文件夹下面,展开TFS文件夹,在 …
TFS Visual Studio

VS2012在Surface RT上远程调试App

最近蛋疼,所以废话不多,直接切入正题。首先这次要说的是Surface RT,是RT版的,ARM处理器的,别弄错了。我们要做的是把工作机上写好的程序放在Surface RT远程调试,而不是在本机和模拟器中运行。 第一步,在Surface RT上安装微软官方的debugger:http://go.microsoft.com/?linkid=9810474 这个debugger是桌面环境下运行的,安装的时候需要管理员权限。 装完以后,开始屏幕上会出现这两个图标,我们要用的是第一个:Remote Debugger。 启动Remote Debugger,正常情况会让你配一些Windows防火墙,你可以完全按照向导来,最终会出现一个Monitor对话框,证明debugger已经在监听连接了。 接下来有个比较有技巧的地方,如果你的Surface RT上的当前用户和开发程序的机器的登录帐户不一样,建 …
Debug Visual Studio Windows Surface ARM

Force Visual Studio Always Run As Administrator

If you are doing ASP.NET development that requrie your project bind to IIS, you will need to open Visual Studio every time as Administrator, which is annoying.  However, there's a way to make Visual Studio run as Administrator by default every time without shutting down UAC on your system. 1. Find your Visual Studio install path For example, I am using Visual Studio 2017.3 Preview, so my install …
Visual Studio UAC

如何从TFS2012上删除Team Project

很久以前,微软就推出了在线版的TFS服务(tfspreview.com),当年还是preview,现在已经是正式版可以在线免费使用了。我很久之前也创建了几个测试用的project在里面,结果现在删不掉了。 可以确定的是,不论在网页版TFS的操作界面上,还是Visual Studio 2012里,都找不到删除Team Project的操作。经过一番谷歌,删Team Project得到CMD里进行。 工具叫做TFSDeleteProject.exe,在你的VS安装目录的这个位置,比如: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE 具体介绍可以看MSDN上的这篇文章:http://msdn.microsoft.com/en-us/library/ms181482%28v=vs.110%29.aspx 操作如下: …
TFS Visual Studio

超详细图解:自己架设NuGet服务器

NuGet 是.NET程序员熟知的给.NET项目自动配置安装library的工具,现在已经整合在了VS2010 SP1和VS2012里。但有时候,尤其在某些公司内部,因为公司防火墙,VS是没办法连接NuGet服务器的。所以我们需要自己架设一个私服。 一、网站构建 首先,确保你的机器在互联网上,并且能够访问NuGet服务器。 创建一个空的ASP.NET网站,选择Framework4(因为考虑到部署问题,很多服务器还没有装.NET4.5,所以我们只能选4) 接下来,用NuGet为这个Web Project安装“NuGet.Server”库。这也是为什么我们需要这台机器能够连接互联网的原因。 安装成功后,你的Solution会变成这样一个结构。并且不需要写任何代码或更改任何配置,它已经可以运行了。但是注意,Packages里只有一个readme.txt,这个目录是用来放NuGet包的。所以现 …
Visual Studio NuGet

MVC3项目升级到VS2012后无法自动bin deploy的解决办法

前不久我把博客升级到了VS2012的solution,结果bin deploy爆掉了。以前在VS2010里,如果打了SP1补丁的话,对MVC3项目点右键,会多出一个菜单,叫做“Add Deployable Dependencies”, 它会在你的项目文件夹里建一个叫做“_bin_deployableAssemblies”的特殊文件夹,里面放的是MVC3项目的几个dll。在publish的时候会自动拷贝到bin目录里。具体可以参考这篇文章:http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx 然而,在VS2012里,这个选项居然木有了。我查阅了官方的说明,说明中居然写着VS2012会自动进行bin deploy。可是我的博客升级以后就再也没自动过。但是,如果用VS2012新建一个MVC3项目,却是可以自 …
Visual Studio