Closed seankearney closed 11 years ago
@dougrathbone just filed an issue with this same request (#61).
I was thinking it would be better to simply support executing multiple transforms (including more than 2). In that case when the pub-int.ps1 is executed when prompted for transforms to execute you could enter something like the following.
Transforms: release, qa, qa01
Where the following transforms are executed in the order below.
What do you guys think?
I think I can run with that!
FYI currently transforms are executed with msbuild.exe from pub-int.ps1. Now that XDT has been shipped on NuGet I can remove this and just invoke straight through PS. As a part of this work I'm gonna refactor to not call msbuild.exe for the transform.
FYI I've created a new issue to track updating how transforms are executed #63.
OK I think I have something which is working here.
I've published a pre-release on nuget.org. You can try it out by executing the following command in the package manage console.
install-package PackageWeb -pre
It should install PackageWeb 1.1.11-beta2 (or higher).
When you run Publish-Interactive.ps1
and are prompted for the transform to execute you can pass in multiple transforms by separating them with a semi-colon ;
. For example if you want to run the following transforms
You will enter release;sayedsample
.
Please try it out and let me know what you think and if you run into any bugs.
When I was trying it I noticed that the TransformName value is not being saved into the publishconfiguration.ps1 file. I've opened issue #64 to track it for the same release as this one.
I'll keep this item open for a day or so in case of discussion but I think this item is complete. Let me know if you think otherwise.
Upon running it I am greeted with this exception:
Write-Error : An error has occurred around line [], message = [System.Management.Automation.MethodInvocationException: Exception calling "LoadFile" with "1" argument(s): "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. (Exception from HRESULT: 0x8013101B)" ---> System.BadImageFormatException: This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. (Exception from HRESULT: 0x8013101B)
at System.Reflection.Assembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at LoadFile(Object , Object[] )
at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[] originalArguments)
--- End of inner exception stack trace ---
at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[] originalArguments)
at System.Management.Automation.DotNetAdapter.MethodInvokeDotNet(String methodName, Object target, MethodInformation[] methodInformation, Object[] arguments)
at System.Management.Automation.Adapter.BaseMethodInvoke(PSMethod method, Object[] arguments)
at System.Management.Automation.ParserOps.CallMethod(Token token, Object target, String methodName, Object[] paramArray, Boolean callStatic, Object valueToSet)
at System.Management.Automation.MethodCallNode.InvokeMethod(Object target, Object[] arguments, Object value)
at System.Management.Automation.MethodCallNode.Execute(Array input, Pipe outputPipe, ExecutionContext context)
at System.Management.Automation.PipelineNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
at System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeNode statement, Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)]
I am running the deploy process within a VS2012 command prompt and my projects are all .NET 4.5.
The issue here is that PS on platforms < win 8 uses .NET 2.0 CLR. I'll need to find a way to invoke the PS script with .NET 4.0 available. I will need to do some research on this. If you have any ideas the best way to achieve it I'd appreciate the comments.
The only way I know of is to wrap the PSH processes with a config that tells it to run using the latest CLR. See http://stackoverflow.com/questions/2094694/how-can-i-run-powershell-with-the-net-4-runtime
Registry hack or app.config pick your poison http://stackoverflow.com/questions/2094694/how-can-i-run-powershell-with-the-net-4-runtime
I don't need to run the entire script using 4.0 CLR. I think I should do the following.
For the last step I can use the PowerShell class http://msdn.microsoft.com/en-us/library/windows/desktop/system.management.automation.powershell(v=vs.85).aspx.
Let me know if you have any better ideas.
OK I have posted a new version 1.1.11-beta4
on nuget.org which should run fine under < windows 8. The changes I made were to call a .exe to perform the transformation instead of executing the transform as a part of the PS script itself.
Can you guys try it out and let me know if it works?
There is still some code cleanup that needs to happen, but it should be good to try out.
@seankearney @dougrathbone, have you guys tried out the support yet? Wondering if this is what we need here?
FYI I will be going to Yellowstone tomorrow for the next week so won't have any connectivity.
Thanks Sayed. This seems to work well for me.
I'm going to close this since the functionality seems to be working as expected.
I think Scott Ha nailed down the way transforms should work with this post http://www.hanselman.com/blog/TinyHappyFeatures3PublishingImprovementsChainedConfigTransformsAndDeployingASPNETAppsFromTheCommandLine.aspx
This is how I would ideally like the chaining of config transforms to work (not limited to web.config files see issue #51 ) except I want the transforms at deploy time, not build time. Hence this feature request to PackageWeb.