朋友们好:我机器上装有net 2.0;net 3.0; net 3.5。当我用clickOnce发布程序时:发现VS2005用的是net 3.0进行编译的。
我可以手动选择.net 的版本吗?

解决方案 »

  1.   

    1.在“项目”--“属性”---“引用”中将未使用的引用都删去 
    2.如果你的程序是1.exe,那新建一个1.exe.config的档案。贴上下面的内容: 
    xml version =1.0 
    configuration 
        startup 
            requiredRuntime version=v2.0.50727 
        startup 
        runtime 
          developmentMode developerInstallation=true 
      runtime 
    configuration 
    如果程序可以运行,就可以使用2.0发布了。上面那个配置文件的作用就是让强制程序在net 2.0的环境下运行
      

  2.   

    VS2005默认的就是2.0吧
    还用得着什么选择吗?
    呵呵,楼主说错了吧VS08才可以有得选择的哈。
      

  3.   

    vs2005不能选择框架,默认是.net 2.0,只有vs2008可以选择框架。
      

  4.   

    有个.net 3.0 for vs2005的补丁,不过。为什么不直接用vs2008呢
      

  5.   


    我也是这么认为的,可是当我的程序发布在客户机器上时:报了一个需要.net 3.0的错。。
      

  6.   


    谢谢你提供的方法,现在程序的确是用net 2.0 编译的
    但是,用clickOnce发布后,在一台只装了了.net 2.0的机器上安装时,报了以下一个错:
    Unable to install or run the application. The application requires that assembly WindowsBase Version 3.0.0.0 be installed in the Global Assembly Cache (GAC) first. Please contact your system administrator.不知道你可以解决吗?
      

  7.   

    http://blogs.msdn.com/mwade/default.aspxOne of the items in the ClickOnce manifest are "pre-requisite assemblies", which are expressed as a preRequisite assembly dependency:
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true"> 
      <assemblyIdentity name="WindowsBase" version="3.0.0.0" publicKeyToken="31bf3856ad364e35" language="neutral" processorArchitecture="msil" /> 
    </dependentAssembly>
    你发布的文件中应该可以查找到上面的内容,改成下面的再试试<dependency> 
      <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true"> 
        <assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="2.0.50727.0" /> 
      </dependentAssembly> 
    </dependency>
      

  8.   


    你真的很厉害!
    我现在的环境是这样的:
      <dependency>
        <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
          <assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="2.0.50727.0" />
        </dependentAssembly>
    ..................................................
    ..................................................
        <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
          <assemblyIdentity name="WindowsBase" version="3.0.0.0" publicKeyToken="31BF3856AD364E35" language="neutral" processorArchitecture="msil" />
        </dependentAssembly>
      </dependency>问题应该就是<assemblyIdentity name="WindowsBase" version="3.0.0.0">在User机器上没有.
    User机器系统是2003 Server,我的系统是XP,跟这个有关系吗?
    User
      

  9.   

    这个和操作系统没有关系。
    直接替换如果有问题可以试试Bootstrapper 工具。
    http://www.cnblogs.com/feishunji/archive/2009/03/24/1420758.html
                      
    http://www.microsoft.com/downloads/details.aspx?FamilyId=BF253CFD-1EFC-4FC5-BA7E-6A6F21403495&displaylang=en
      

  10.   

    其实方便一点的话就用VS2008吧,里面的.Net环境可以自由选择。
      

  11.   


    Bootstrapper Manifest Generator 真的很棒!曾经我也在为怎么加入其它的组件发愁。
    我现在已经将.net framework 3.0的安装包加到了Prerequisites中。。
    User的那台机器是64位的操作系统,装.net framework 3.0(x64)居然败了("File is corrupt")折腾一大圈,我还是用VS2008试试吧。。
    谢谢了
      

  12.   

    to: xingyuebuyu
    你提供的"1.exe.config"方式:里面是写xml吗?我的工程不是web版的,我把你写的贴过去后,有语法的错误啊。另外把"xxx.config"放到哪里呢。。
      

  13.   

    http://msdn.microsoft.com/zh-cn/library/9w519wzk(VS.80).aspx配置文件和.exe放在相同的路径下
      

  14.   

    无意中发现:Application Files页面中有一个WindowsBase.dll,默认是不包含在安装包里的。将WindowsBase.dll包含进来,“The application requires that assembly WindowsBase Version 3.0.0.0 be installed in the Global Assembly Cache (GAC) first”的错就没了。现在已经可以安装了,可是运行时确崩了。。这也许是我的机器是32位系统,User机器是64位吧。。
    不过,总算解决了一个问题^^