2016-10-28 10 views
0

私はTechnician.Dispatch.exeという名前のアプリケーションを持っています。アプリケーションを実行しようとするたびに昇格されたアクセス許可が必要です。関連するプロジェクトファイルは次のとおりです。Technician.Dispatch.exeを実行するには昇格されたアクセス許可が必要です

Technician.Dispatch.csproj

<?xml version="1.0" encoding="utf-8"?> 
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> 
    <PropertyGroup> 
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 
    <ProjectGuid>{D1B2C77B-4547-44E6-A453-9F1266E63AFF}</ProjectGuid> 
    <OutputType>Exe</OutputType> 
    <AppDesignerFolder>Properties</AppDesignerFolder> 
    <RootNamespace>Technician.Dispatch</RootNamespace> 
    <AssemblyName>Technician.Dispatch</AssemblyName> 
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> 
    <FileAlignment>512</FileAlignment> 
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> 
    </PropertyGroup> 
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> 
    <PlatformTarget>AnyCPU</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|AnyCPU' "> 
    <PlatformTarget>AnyCPU</PlatformTarget> 
    <DebugType>pdbonly</DebugType> 
    <Optimize>true</Optimize> 
    <OutputPath>bin\Release\</OutputPath> 
    <DefineConstants>TRACE</DefineConstants> 
    <ErrorReport>prompt</ErrorReport> 
    <WarningLevel>4</WarningLevel> 
    </PropertyGroup> 
    <PropertyGroup> 
    <NoWin32Manifest>true</NoWin32Manifest> 
    </PropertyGroup> 
    <ItemGroup> 
    <Reference Include="System" /> 
    <Reference Include="System.Core" /> 
    </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> 

Program.csの

using System; 

namespace Technician.Dispatch 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      Console.Write("Press any key to exit."); 
      Console.ReadKey(); 
     } 
    } 
} 

プロパティ\ AssemblyInfo.cs

using System.Reflection; 
using System.Runtime.InteropServices; 

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information 
// associated with an assembly. 
[assembly: AssemblyTitle("Technician.Dispatch")] 
[assembly: AssemblyDescription("")] 
[assembly: AssemblyConfiguration("")] 
[assembly: AssemblyCompany("")] 
[assembly: AssemblyProduct("Technician.Dispatch")] 
[assembly: AssemblyCopyright("Copyright © 2016")] 
[assembly: AssemblyTrademark("")] 
[assembly: AssemblyCulture("")] 

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components. If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type. 
[assembly: ComVisible(false)] 

// The following GUID is for the ID of the typelib if this project is exposed to COM 
[assembly: Guid("d1b2c77b-4547-44e6-a453-9f1266e63aff")] 

// Version information for an assembly consists of the following four values: 
// 
//  Major Version 
//  Minor Version 
//  Build Number 
//  Revision 
// 
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below: 
// [assembly: AssemblyVersion("1.0.*")] 
[assembly: AssemblyVersion("1.0.0.0")] 
[assembly: AssemblyFileVersion("1.0.0.0")] 

.csprojから次のコードを削除すると、問題が修正されます。

<PropertyGroup> 
    <NoWin32Manifest>true</NoWin32Manifest> 
</PropertyGroup> 

なぜこのコードを削除すると問題が解決されますか?

答えて

1

あなたがproject propertiesに「マニフェストなしでアプリケーションを作成する」ことを選んだので:

デフォルトのオプション「デフォルト設定でマニフェストを埋め込む」:

は、Visual Studioの上で動作する典型的な方法をサポートしていますWindows Vistaは、セキュリティ情報をアプリケーションの実行可能ファイルに埋め込み、requestedExecutionLevel be AsInvokerを指定します。これはデフォルトのオプションです。セキュリティ情報を含むマニフェストを埋め込む

が明示的に持っていることからあなたを惜しみ「呼び出し元の権限でこのアプリケーションを実行する」:理由を抽出するために(強調かれら)

必要なセキュリティ情報を取得するための実行権限を与えます。

+0

私の質問は* _why_ *コードを削除しているので、私はこの回答を受け付けていません。代わりにこのプロジェクトの名前を "Technician.Send"とすると、権限が昇格されていなくても問題なく動作します。プロジェクト/名前空間の意味は何か – Oxymoron

+0

名前はこれと関係がありません。.csprojの引用部分は、記述されたプロジェクト設定を正確に制御します。 – Filburt

+0

なぜ 'Technician.Send'という名前のプロジェクトに同じcsproj設定がこの問題を持たないのかを説明してください。マニフェストがなく、昇格されたアクセス許可は必要ありません – Oxymoron

関連する問題