每次我运行C#控制台应用程序(从Visual C#Express 2010或Visual Studio Ultimate 2010)时,第一行输出是
该系统找不到指定的路径
,即使我的程序没有做任何事情,也没有指定任何路径.为什么会这样?有没有办法检查它正在寻找的路径是什么?程序运行正常.我试图捕获System.IO.DirectoryNotFoundException但无法找出放置try/catch块的位置.
我正在运行Windows 7 x64,构建控制台应用程序,并尝试了所有不同的平台目标(x86,x64,AnyCPU),我可以在Visual Studio中,总是得到相同的
我一直有其他一些问题并且有预感,这可能与那些问题有关,这就是为什么我想弄明白这一点.谢谢!
下面是Visual Studio生成的z .csproj文件(此项目显示我从命令行运行或从VS运行时描述的有问题的行为)
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{04EC9A5E-74D8-4A5F-BCD3-05D9B6CA1477}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UsingNLOpt</RootNamespace>
<AssemblyName>UsingNLOpt</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Run Code Online (Sandbox Code Playgroud)
编辑:已解决 - Microsoft注册表中不存在的目录的自动运行条目.请参阅以下答案.
你能检查你的注册表:
\Software\Microsoft\Command Processor\AutoRun
Run Code Online (Sandbox Code Playgroud)
在HKEY_LOCAL_MACHINE和HKEY_CURRENT_USER荨麻疹?
可能是命令处理器试图在启动时运行某些不存在的东西.
| 归档时间: |
|
| 查看次数: |
1538 次 |
| 最近记录: |