我正在尝试使用Uri.TryCreate方法验证Uri,当我使用无效字符串调用它时,该方法返回true.有什么想法吗?我的代码如下:
private void button1_Click(object sender, EventArgs e)
{
Uri tempValue;
if (Uri.TryCreate("NotAURL", UriKind.RelativeOrAbsolute, out tempValue))
{
MessageBox.Show("?");
}
}
Run Code Online (Sandbox Code Playgroud) 我想在NuGet包安装期间从我的项目中删除App_Start文件夹.NuGet的文档在这里:
http://nuget.codeplex.com/wikipage?title=Creating%20a%20Package
说:
$ project.Object相当于http://msdn.microsoft.com/en-us/library/ms170626.aspx.
我无法找到对我有帮助的界面的大量信息.
我有以下Powershell脚本成功删除文件夹和文件:
param($installPath, $toolsPath, $package, $project)
$DirInfo = New-Object System.IO.DirectoryInfo($installPath)
$appDir = New-Object System.IO.DirectoryInfo($DirInfo.Parent.Parent.FullName)
$fullPath = [IO.Path]::Combine($appDir.FullName, $appDir.Name, "App_start")
Remove-Item $fullPath -recurse
Run Code Online (Sandbox Code Playgroud)
(我知道此处的路径无法保证,但此包仅供内部使用)
但是项目仍然引用了项目,因此项目显示黄色警告,因为Visual Studio认为项目是项目的一部分.
我需要的是一种以编程方式从项目中删除对这些项的引用的方法.有任何想法吗?
我试图在我的WPF应用程序中嵌入一个图标,以便我可以使用以下代码将其拉出来作为Windows 7 JumpList中的图标使用:
newScene.IconResourcePath = System.Reflection.Assembly.GetEntryAssembly().Location;
newScene.IconResourceIndex = 0;
Run Code Online (Sandbox Code Playgroud)
我已经使用以下方法使用它:http://dennisdel.com/?p = 38
但是,它似乎不是最好的方法,似乎应该有一种更简单的方法将图标资源嵌入到我的应用程序中,同时仍然在我的程序的应用程序属性中选中" Icon and Manifest "选项.
我尝试了很多方法,包括将图标构建操作设置为资源和嵌入式资源,但每次在资源编辑器中打开我的.exe时,都不会显示图标.
有什么建议?