繁体   English   中英

Visual Studio重写网站的解决方案配置

[英]Visual Studio rewrite solution configuration for Web Site

我的网站项目有一个解决方案。 共有三种自定义解决方案配置:开发,测试,产品。 但是,网站项目没有.csproj文件,因此无法(或无法找到)使用网站项目的配置。 我正在使用MSBuild构建解决方案:

MSBuild.exe MySolution.sln /m /p:Platform=x86;TargetFrameworkVersion=v4.6.2;OutputPath=bin;Configuration=Dev /ToolsVersion:14.0 

由于.sln文件没有有关我的Web站点项目Dev配置的任何信息,因此只有Debug和Release“ sections”:

Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Web", "Web\", "{1F81A0DB-6FF4-4F89-B988-6D327797C4FD}"
ProjectSection(WebsiteProperties) = preProject
    TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.6.2"
    ProjectReferences = "{12A625AA-8B5A-4336-AA4A-3630AAB3A27D}|MyLib.dll;"
    Debug.AspNetCompiler.VirtualPath = "/localhost_54141"
    Debug.AspNetCompiler.PhysicalPath = "Web\"
    Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_54141\"
    Debug.AspNetCompiler.Updateable = "true"
    Debug.AspNetCompiler.ForceOverwrite = "true"
    Debug.AspNetCompiler.FixedNames = "false"
    Debug.AspNetCompiler.Debug = "True"
    Release.AspNetCompiler.VirtualPath = "/localhost_54141"
    Release.AspNetCompiler.PhysicalPath = "Web\"
    Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_54141\"
    Release.AspNetCompiler.Updateable = "true"
    Release.AspNetCompiler.ForceOverwrite = "true"
    Release.AspNetCompiler.FixedNames = "false"
    Release.AspNetCompiler.Debug = "False"
    VWDPort = "54141"
    SlnRelativePath = "Web\"
    StartServerOnDebug = "false"
EndProjectSection

EndProject

网站尚未建立。

好的,我可以手动编辑解决方案文件并更改/添加Dev.XXXX,Test.XXX等相关设置,直到您在Visual Studio中打开解决方案并将其保存之前,一切运行良好。 Visual Studio将执行所有更改,并且您再次面临相同的问题。

解决方法是,我可以创建.sln文件的副本,然后手动将其与原始解决方案同步。 有人有更好的主意吗?

您可以通过使用不同的自定义AspNetCompiler MSBuild任务来构建Web站点项目。 像这样:

开发人员

<Project xmlns = "http://schemas.microsoft.com/developer/msbuild/2003">
        <Target Name = "PrecompileWeb">
                <AspNetCompiler
                        VirtualPath = "/dev" 
                        PhysicalPath = "D:\Project\WebSite1\"
                        TargetPath = "PrecompiledWeb\dev\"
                        Force = "true"           
                        Debug = "False"
                        Updateable = "true"/>
        </Target>
</Project>

Test.msbuild

<Project xmlns = "http://schemas.microsoft.com/developer/msbuild/2003">
            <Target Name = "PrecompileWeb">
                    <AspNetCompiler
                            VirtualPath = "/test" 
                            PhysicalPath = "D:\Project\WebSite1\"
                            TargetPath = "PrecompiledWeb\test\"
                            Force = "true"           
                            Debug = "False"
                            Updateable = "true"/>
            </Target>
    </Project>

像这样的构建命令:

MSBuild.exe dev.msbuild /m /p:TargetFrameworkVersion=v4.6.2;OutputPath=bin /ToolsVersion:14.0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM