Every time I run a C# console application (either from Visual C# Express 2010 or Visual Studio Ultimate 2010), the first line of output is
The system cannot find the path specified
, even when my program doesn't do anything, and doesn't specify any paths. Why would this happen? Is there some way to check what the path it's looking for might be? Programs run fine otherwise. I tried to catch a System.IO.DirectoryNotFoundException but couldn't figure out where to put the try/catch blocks.
I am running Windows 7 x64, building console applications, and have tried all the different platform targets (x86, x64, AnyCPU) I can in Visual Studio, always getting the same
I have been having some other issues and have a hunch this may have something to do with those, which is why I am trying to figure it out. Thanks!
Below is z .csproj file that Visual Studio generated (this project displays the problematic behavior I am describing when run from the command line or when run from 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>
EDIT: Solved - an Autorun entry to an nonexistent directory in the registry for the Microsoft Console. See the answer below.
Can you check your registry:
\Software\Microsoft\Command Processor\AutoRun
in both the HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER hives?
It may be that the command processor is trying to run something on startup that isn't there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With