如何在具有 website.publishproj 文件的本地上运行 .net 4.5 应用

How to run a .net 4.5 app on local that has a website.publishproj file

提问人:Chris Rockwell 提问时间:8/24/2023 更新时间:8/24/2023 访问量:30

问:

我正在尝试运行一个旧的 .net 应用程序。我习惯于看到.sln文件,但这个项目有一个website.publishproj文件。

我可以通过右键单击website.publishproj文件并选择“构建”来构建项目,但我只是得到它成功了,我需要它在浏览器中运行:

enter image description here

猜测 .publishproj 文件是相关的文件,所以我包含了以下内容:

<?xml version="1.0" encoding="utf-8"?>
<!--

***********************************************************************************************
website.publishproj

WARNING: DO NOT MODIFY this file, it is used for the web publish process.

Copyright (C) Microsoft Corporation. All rights reserved.

***********************************************************************************************
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.30319</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{f4e28bbe-e8b3-4faa-8b4d-c6e36eee6659}</ProjectGuid>
    <SourceWebPhysicalPath>$(MSBuildThisFileDirectory)</SourceWebPhysicalPath>
    <SourceWebVirtualPath>/LaunchPad</SourceWebVirtualPath>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
    <SourceWebProject>http://localhost:56565</SourceWebProject>
    <SourceWebMetabasePath>/IISExpress/7.5/LM/W3SVC/16/ROOT</SourceWebMetabasePath>
  </PropertyGroup>
  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
    <!-- for VS2010 we need to use 10.5 but for VS2012+ we should use VisualStudioVersion -->
    <WebPublishTargetsVersion Condition=" '$(WebPublishTargetsVersion)' =='' and '$(VisualStudioVersion)' == 10.0 ">10.5</WebPublishTargetsVersion>
    <WebPublishTargetsVersion Condition=" '$(WebPublishTargetsVersion)'=='' ">$(VisualStudioVersion)</WebPublishTargetsVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(WebPublishTargetsVersion)</VSToolsPath>
    <_WebPublishTargetsPath Condition=" '$(_WebPublishTargetsPath)'=='' ">$(VSToolsPath)</_WebPublishTargetsPath>
    <AssemblyFileVersion Condition="'$(AssemblyFileVersion)' == ''">1.0.0.0</AssemblyFileVersion>
    <AssemblyVersion Condition="'$(AssemblyVersion)' == ''">1.0.0.0</AssemblyVersion>
  </PropertyGroup>
  <ItemGroup>
    <AssemblyAttributes Include="AssemblyFileVersion">
      <Value>$(AssemblyFileVersion)</Value>
    </AssemblyAttributes>
    <AssemblyAttributes Include="AssemblyVersion">
      <Value>$(AssemblyVersion)</Value>
    </AssemblyAttributes>
  </ItemGroup>
  <Import Project="$(_WebPublishTargetsPath)\Web\Microsoft.WebSite.Publishing.targets" />
</Project>

我如何运行它,以便它的网站实际上在浏览器中运行?

可视化工作室 net-4.5

评论

0赞 Panagiotis Kanavos 8/24/2023
这既不是项目文件,也不是项目文件。 文件是指向实际项目文件的解决方案文件。它们甚至不包括项目引用。,正如评论所说,这是一个发布项目。你不运行它,你用它来发布项目。.sln.slnpublishproj
0赞 Panagiotis Kanavos 8/24/2023
这可能是一个网站项目,这种类型在 .NET Framework 4.5 发布并最终停止使用时已弃用。源代码按原样部署,未预编译。服务器上的 ASP.NET 将单独编译每个文件。虽然这使得临时开发更容易(你可以只上传修改后的源文件),但对于..现在我们所做的任何事情:测试、暂存、版本控制。别介意安全。
0赞 Chris Rockwell 8/24/2023
你是对的;我的同事向我展示了如何在 Visual Studio 中打开一个“网站”,这是我需要做的,以便在我的本地运行它

答: 暂无答案